- refactored NPED Login & logout

This commit is contained in:
2025-10-27 09:35:59 +00:00
parent 18534ceb2c
commit 251a2f5e7b
11 changed files with 76 additions and 76 deletions

View 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 };
}
}