refactor: move most routing logic to tanstack

This commit is contained in:
Prayag Prajapati committed 2024-05-29 18:10:22 +05:30
1 parent b8552ac35d
commit c22dbefeea
22 files changed
+1191 -1502

No files matched your search

+13 -12
View File
@@ -29,22 +29,23 @@ export const Route = createFileRoute("/_api")({
try {
await getSystemApi(context.api).getPingSystem(); // Verify server status
} catch (error) {
console.error(error);
throw redirect({
to: "/setup/server/error",
search: {
redirect: location.href,
},
});
}
try {
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
} catch (error) {
throw redirect({
to: "/login/manual",
search: {
redirect: location.href,
},
});
if (context.api.accessToken) {
try {
await getUserApi(context.api).getCurrentUser(); // Verify user is able to authenticate
} catch (error) {
console.error(error);
throw redirect({
to: "/login/manual",
search: {
redirect: location.href,
},
});
}
}
}
},