From 0adbf9af72ac6cc241009e2d93642e1e4c24d727 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Wed, 23 Dec 2020 10:42:20 +0200 Subject: [PATCH] removed unused code --- .../login/components/LoginContainer.js | 9 ++------- src/state/initialState.js | 5 ----- src/state/reducer.js | 18 +----------------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/features/login/components/LoginContainer.js b/src/features/login/components/LoginContainer.js index 206e569..ef6353a 100644 --- a/src/features/login/components/LoginContainer.js +++ b/src/features/login/components/LoginContainer.js @@ -2,19 +2,14 @@ import React, { useContext } from "react"; import LoginComponent from "./LoginComponent"; import Button from "@material-ui/core/Button"; import { authenticate } from "../../../utils/identity"; -import { - ApplicationStateContext, - ApplicationDispatchContext -} from "../../../state/ApplicationContexts"; +import { ApplicationStateContext } from "../../../state/ApplicationContexts"; const LoginContainer = () => { const state = useContext(ApplicationStateContext); - const dispatchActions = useContext(ApplicationDispatchContext); const handleLogin = async () => { const { userName, password } = state.credentials; - const token = await authenticate(userName, password); - dispatchActions.onAuthorizationTokenChange(token); + await authenticate(userName, password); }; return ( diff --git a/src/state/initialState.js b/src/state/initialState.js index 20f3db8..754d0e3 100644 --- a/src/state/initialState.js +++ b/src/state/initialState.js @@ -3,11 +3,6 @@ export const initialState = { userName: "", password: "" }, - security: { - authorization: { - token: null - } - }, network: { test: "" } diff --git a/src/state/reducer.js b/src/state/reducer.js index 9542972..2462eda 100644 --- a/src/state/reducer.js +++ b/src/state/reducer.js @@ -10,20 +10,6 @@ export function reducer(state, action) { } }; } - case "onAuthorizationTokenChange": { - const { token } = action.payload; - - return { - ...state, - security: { - ...state.security, - authorization: { - ...state.security.authorization, - token - } - } - }; - } case "onNetworkChange": { const { prop, value } = action.payload; return { @@ -44,7 +30,5 @@ export const dispatchActions = dispatch => ({ onCredentialsChange: (prop, value) => dispatch({ type: "onCredentialsChange", payload: { prop, value } }), onNetworkChange: (prop, value) => - dispatch({ type: "onNetworkChange", payload: { prop, value } }), - onAuthorizationTokenChange: token => - dispatch({ type: "onAuthorizationTokenChange", payload: { token } }) + dispatch({ type: "onNetworkChange", payload: { prop, value } }) });