fix: KÜs werden angezeigt, _app.tsx error
This commit is contained in:
@@ -4,12 +4,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import store, { useAppDispatch } from "../redux/store";
|
import store, { useAppDispatch } from "../redux/store";
|
||||||
|
import { loadWindowVariables } from "../utils/loadWindowVariables";
|
||||||
import Header from "../components/header/Header";
|
import Header from "../components/header/Header";
|
||||||
import Navigation from "../components/navigation/Navigation";
|
import Navigation from "../components/navigation/Navigation";
|
||||||
import Footer from "../components/footer/Footer";
|
import Footer from "../components/footer/Footer";
|
||||||
import WindowVariablesInitializer from "../components/WindowVariablesInitializer";
|
import WindowVariablesInitializer from "../components/WindowVariablesInitializer";
|
||||||
import "../styles/globals.css";
|
import "../styles/globals.css";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
|
import { setVariables } from "../redux/slices/variablesSlice";
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return (
|
return (
|
||||||
@@ -26,6 +28,15 @@ function AppContent({ Component, pageProps }: AppProps) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadAndStoreVariables = async () => {
|
const loadAndStoreVariables = async () => {
|
||||||
try {
|
try {
|
||||||
|
const variables = await loadWindowVariables();
|
||||||
|
if (!variables) throw new Error("Sitzungsfehler");
|
||||||
|
|
||||||
|
//console.log("✅ Window-Variablen geladen:", variables);
|
||||||
|
|
||||||
|
const { ...restVariables } = variables;
|
||||||
|
|
||||||
|
dispatch(setVariables(restVariables));
|
||||||
|
|
||||||
setSessionExpired(false);
|
setSessionExpired(false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("❌ Fehler beim Laden der Sitzung:", error);
|
console.error("❌ Fehler beim Laden der Sitzung:", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user