From 925273f20f3893ec453b86f8c061cacd1a3f967c Mon Sep 17 00:00:00 2001 From: MiraGeowerktstatt Date: Mon, 8 Aug 2022 17:12:51 +0200 Subject: [PATCH] Refresh with useHistory --- src/ClientApp/src/components/Layout.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/ClientApp/src/components/Layout.js b/src/ClientApp/src/components/Layout.js index 3695bf6..cada310 100644 --- a/src/ClientApp/src/components/Layout.js +++ b/src/ClientApp/src/components/Layout.js @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import { useHistory } from "react-router-dom"; import { createTheme, ThemeProvider } from "@mui/material/styles"; import CssBaseline from "@mui/material/CssBaseline"; import { @@ -36,6 +37,15 @@ export function Layout(props) { setOpen(!open); }; + async function handleLogout() { + const response = await fetch("/login/sls/auth?cmd=logout"); + if (response.ok) { + history.push("/"); + } + } + + const history = useHistory(); + return ( @@ -62,16 +72,9 @@ export function Layout(props) { Grundlagedaten EWS - - { - setTimeout(window.location.reload, 1000); - }} - sx={{ color: "white" }} - > - - - + + +