feat: Auth-Status bei App-Start aus localStorage laden und in Redux speichern
- fetchAuthService erstellt zum Auslesen von isAdminLoggedIn aus localStorage - getAuthThunks Thunk implementiert zur Initialisierung von authSlice - authSlice erweitert um setIsAdminLoggedIn Reducer - dispatch(getAuthThunks()) in _app.tsx integriert für automatische Initialisierung bei App-Start - Flackern und falscher Admin-Status nach Reload dauerhaft behoben
This commit is contained in:
@@ -23,6 +23,7 @@ import { getReferenceCurveBySlotThunk } from "@/redux/thunks/getReferenceCurveBy
|
||||
import { getAllTDRReferenceChartThunk } from "@/redux/thunks/getAllTDRReferenceChartThunk";
|
||||
import { getTDRChartDataByIdThunk } from "@/redux/thunks/getTDRChartDataByIdThunk";
|
||||
import { getLoopChartDataThunk } from "@/redux/thunks/getLoopChartDataThunk";
|
||||
import { getAuthThunks } from "@/redux/thunks/getAuthThunks";
|
||||
import Modal from "react-modal";
|
||||
if (typeof window !== "undefined") {
|
||||
Modal.setAppElement("#__next"); // oder "#root", je nach App-Struktur
|
||||
@@ -54,6 +55,7 @@ function AppContent({
|
||||
const pathname = window.location.pathname;
|
||||
|
||||
const loadAndDispatch = () => {
|
||||
dispatch(getAuthThunks());
|
||||
if (pathname.includes("kabelueberwachung")) {
|
||||
dispatch(getKueDataThunk());
|
||||
} else if (pathname.includes("digitalOutputs")) {
|
||||
|
||||
Reference in New Issue
Block a user