Clean up all references to authenticatedData

- De facto, was being assumed everywhere if authenticatedData is null, that it's not logged in. This isn't true because the data can still be loading. Update the hook to send additional states.
- Bonus: Delete model picker code and a slew of unused imports.
This commit is contained in:
sabaimran
2024-12-21 08:45:43 -08:00
parent cc7fd1163f
commit e9dae4240e
15 changed files with 155 additions and 341 deletions

View File

@@ -19,13 +19,11 @@ const fetcher = (url: string) =>
.catch((err) => console.warn(err));
export function useAuthenticatedData() {
const { data, error } = useSWR<UserProfile>("/api/v1/user", fetcher, {
const { data, error, isLoading } = useSWR<UserProfile>("/api/v1/user", fetcher, {
revalidateOnFocus: false,
});
if (error || !data || data.detail === "Forbidden") return null;
return data;
return { data, error, isLoading };
}
export interface ModelOptions {