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": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.3.0",
|
"@types/node": "^25.3.0",
|
||||||
"@types/react-toggle": "^4.0.5",
|
"@types/react-toggle": "^4.0.5",
|
||||||
"@vitejs/plugin-react": "^5.1.4",
|
"@vitejs/plugin-react-swc": "^4.3.0",
|
||||||
"i18n-unused": "^0.19.0",
|
"i18n-unused": "^0.19.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^7.3.1"
|
"vite": "^7.3.1"
|
||||||
|
|||||||
@ -31,6 +31,17 @@ const HtmlIsland: React.FC<HtmlIslandProps> = ({
|
|||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
try {
|
try {
|
||||||
const r = await fetch(url, { credentials: "include" });
|
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}`);
|
if (!r.ok) throw new Error(`Failed to load island: ${r.status}`);
|
||||||
return await r.text();
|
return await r.text();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user