removed unused code

master
Tudor Stanciu 2020-12-23 10:42:20 +02:00
parent 30510d9a73
commit 0adbf9af72
3 changed files with 3 additions and 29 deletions

View File

@ -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 (

View File

@ -3,11 +3,6 @@ export const initialState = {
userName: "",
password: ""
},
security: {
authorization: {
token: null
}
},
network: {
test: ""
}

View File

@ -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 } })
});