fix: login page not working

This commit is contained in:
Prayag Prajapati committed 2024-07-22 18:59:17 +05:30
1 parent a5ca2ff9bb
commit ffbca70de3
8 files changed
+76 -143

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/_api/login")({
beforeLoad: async ({ context, location }) => {
if (location.pathname === "/login") {
const api = context.api;
console.log(api);
const publicUsers = (await getUserApi(api).getPublicUsers()).data;
if (publicUsers.length > 0) {
throw redirect({ to: "/login/list" });
}
throw redirect({ to: "/login/manual" });
}
},
});