removed unused code
parent
30510d9a73
commit
0adbf9af72
|
@ -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 (
|
||||
|
|
|
@ -3,11 +3,6 @@ export const initialState = {
|
|||
userName: "",
|
||||
password: ""
|
||||
},
|
||||
security: {
|
||||
authorization: {
|
||||
token: null
|
||||
}
|
||||
},
|
||||
network: {
|
||||
test: ""
|
||||
}
|
||||
|
|
|
@ -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 } })
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue