Skip to content

Commit e68441c

Browse files
committed
fix: try fixing token invalidate bug
1 parent f40d857 commit e68441c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/app/src/api/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const client = new Client({
2323
async refreshAuth() {
2424
if (isAuthenticated()) {
2525
logout();
26+
window.location.reload();
2627
}
2728
},
2829
};

packages/app/src/routes/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { useRef } from "react";
33
import { fetchProfile, isAuthenticated } from "../api/auth";
44
import { EditorAppShell } from "../components/appshell";
55
import { createParametersStore, ParametersContext } from "../stores/parameters";
6-
import "../styles/editor.css";
76
import { getInitialInputsFromUrl } from "../share/urlShare";
87
import { preloadDefaultFonts } from "../stores/fonts";
98
import "../styles/editor.css";
109
import "../styles/page.css";
1110

1211
export const Route = createFileRoute("/")({
1312
component: Editor,
14-
beforeLoad: ({ location }) => {
13+
beforeLoad: async ({ location }) => {
14+
await fetchProfile();
1515
if (!isAuthenticated()) {
1616
throw redirect({
1717
to: "/login",
@@ -33,7 +33,7 @@ export function Editor() {
3333
const profile = Route.useLoaderData();
3434
const initialFromUrl = getInitialInputsFromUrl(window.location.href);
3535
const store = useRef(
36-
createParametersStore({ name: profile?.login ?? "", ...initialFromUrl }),
36+
createParametersStore({ name: profile?.login, ...initialFromUrl }),
3737
).current;
3838

3939
return (

0 commit comments

Comments
 (0)