- Renamed all slice names (createSlice `name` attribute) to match their file names (e.g. loopChartSlice, authSlice, kueDataSlice etc.) - Updated `store.ts` to register each reducer with consistent key names (e.g. state.loopChartSlice instead of state.loopChart) - Adjusted all `useSelector` and Redux state accesses across the codebase - Improves maintainability, searchability and consistency across files and Redux DevTools
30 lines
764 B
TypeScript
30 lines
764 B
TypeScript
// redux/slices/authSlice.ts
|
|
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
const authSlice = createSlice({
|
|
name: "authSlice",
|
|
initialState: {
|
|
isAdminLoggedIn: false,
|
|
users: {
|
|
Admin: {
|
|
username: "admin",
|
|
password:
|
|
"$2a$10$WO/pzNjkkbC4X3aCEcwd2ugMHQ8Wzq0unCYNePTAL01ZrS/rEAcGu", // Gehashte Version von "admin"
|
|
},
|
|
Ismail: {
|
|
username: "ismail",
|
|
password:
|
|
"$2a$10$WO/pzNjkkbC4X3aCEcwd2ugMHQ8Wzq0unCYNePTAL01ZrS/rEAcGu", // Gehashte Version von "ismail"
|
|
},
|
|
},
|
|
},
|
|
reducers: {
|
|
setAdminLoggedIn: (state, action) => {
|
|
state.isAdminLoggedIn = action.payload;
|
|
},
|
|
},
|
|
});
|
|
|
|
export const { setAdminLoggedIn } = authSlice.actions;
|
|
export default authSlice.reducer;
|