This commit is contained in:
Truong Nguyen
2024-07-11 15:32:25 +07:00
parent f0c4f1f39e
commit a49f46a25e
17 changed files with 327 additions and 125 deletions

View File

@@ -18,7 +18,7 @@
"SidebarStatus": true,
"EpThemeColor": "#409EFF",
"ShowLogo": true,
"ShowModel": "smart",
"ShowModel": "chrome",
"MenuArrowIconNoTransition": false,
"CachingAsyncRoutes": false,
"TooltipEffect": "light",

11
public/silent-renew.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<script type="module" src="./silent-renew.ts"></script>
<body></body>
</html>

20
public/slient-renew.ts Normal file
View File

@@ -0,0 +1,20 @@
import { useOidcStore } from "vue3-oidc";
const { state: oidcState } = useOidcStore();
oidcState.value.userManager?.signinSilentCallback();
const LOGIN_REQUIRED = "login_required";
const searchParams = new URLSearchParams(window.location.search);
const error = searchParams.get("error");
const state = searchParams.get("state");
const isLocalService = location.origin.includes(
"://localhost" || "0.0.0.0" || "127.0.0.0"
);
console.error(`Error: \n error: ${error} \n state: ${state}`);
if (error === LOGIN_REQUIRED && import.meta.env && !isLocalService) {
localStorage.clear();
sessionStorage.clear();
top?.location.reload();
}