mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-29 01:17:52 +01:00
Oauth2 support
This commit is contained in:
25 files changed
+529
-30
No files matched your search
+14
-2
@@ -1,7 +1,8 @@
|
||||
import { lazy, Suspense } from "react";
|
||||
|
||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
||||
|
||||
import { TokenResponse } from "src/api/npm";
|
||||
import { SiteWrapper, SpinnerPage, Unhealthy } from "src/components";
|
||||
import { useAuthState, useLocaleState } from "src/context";
|
||||
import { useHealth } from "src/hooks";
|
||||
@@ -24,10 +25,21 @@ const Users = lazy(() => import("src/pages/Users"));
|
||||
|
||||
function Router() {
|
||||
const health = useHealth();
|
||||
const { authenticated } = useAuthState();
|
||||
const { authenticated, handleTokenUpdate } = useAuthState();
|
||||
const { locale } = useLocaleState();
|
||||
const Spinner = <SpinnerPage />;
|
||||
|
||||
// Load token from URL Query Params
|
||||
const searchParams = new URLSearchParams(document.location.search);
|
||||
const t = searchParams.get("token_response");
|
||||
if (t) {
|
||||
const tokenResponse: TokenResponse = JSON.parse(t);
|
||||
handleTokenUpdate(tokenResponse);
|
||||
window.location.href = "/";
|
||||
return;
|
||||
}
|
||||
// End Load token from URL Query Params
|
||||
|
||||
if (health.isLoading) {
|
||||
return Spinner;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user