Websocket and auth fixes
This commit is contained in:
@@ -5,6 +5,7 @@ import Cookies from "js-cookie";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { get } from "@/lib/request";
|
||||
import { toast } from "sonner";
|
||||
|
||||
export interface UserProfile extends ProfileSettings {
|
||||
id: string;
|
||||
@@ -24,8 +25,9 @@ export default function useUser() {
|
||||
|
||||
try {
|
||||
setUser((await get("/api/profile")).data);
|
||||
} catch {
|
||||
} catch (e: any) {
|
||||
router.push("/login");
|
||||
toast.error(`Error: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user