- refactored NPED Login & logout
This commit is contained in:
31
src/context/reducers/IntegrationsContextReducer.ts
Normal file
31
src/context/reducers/IntegrationsContextReducer.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { NPEDACTION, NPEDSTATE } from "../../types/types";
|
||||
|
||||
export const initialState = {
|
||||
sessionStarted: false,
|
||||
sessionList: [],
|
||||
sessionPaused: false,
|
||||
savedSightings: [],
|
||||
npedUser: null,
|
||||
};
|
||||
|
||||
export function reducer(state: NPEDSTATE, action: NPEDACTION) {
|
||||
switch (action.type) {
|
||||
case "SESSIONSTART":
|
||||
return {
|
||||
...state,
|
||||
sessionStarted: action.payload,
|
||||
};
|
||||
case "LOGIN":
|
||||
return {
|
||||
...state,
|
||||
npedUser: action.payload,
|
||||
};
|
||||
case "LOGOUT":
|
||||
return {
|
||||
...state,
|
||||
npedUser: action.payload,
|
||||
};
|
||||
default:
|
||||
return { ...state };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user