Fixed the sso auto login with the htmlisland, and also fixed the extremely slow page reloads in development mode.
This commit is contained in:
parent
fe4dc828f1
commit
39b15af5b0
@ -80,7 +80,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.3.0",
|
||||
"@types/react-toggle": "^4.0.5",
|
||||
"@vitejs/plugin-react": "^5.1.4",
|
||||
"@vitejs/plugin-react-swc": "^4.3.0",
|
||||
"i18n-unused": "^0.19.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.3.1"
|
||||
|
||||
@ -31,6 +31,17 @@ const HtmlIsland: React.FC<HtmlIslandProps> = ({
|
||||
): Promise<string> => {
|
||||
try {
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const contentType = r.headers.get("Content-Type") ?? "";
|
||||
|
||||
if (contentType.includes("application/json")) {
|
||||
const json = await r.json();
|
||||
|
||||
if (json.redirectTo) {
|
||||
window.location.assign(json.redirectTo);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
if (!r.ok) throw new Error(`Failed to load island: ${r.status}`);
|
||||
return await r.text();
|
||||
} catch (err) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user