dsql-admin/dsql-app/hooks/useLocalUser.ts
Benjamin Toby 81cf010cb5 Updates
2025-01-14 16:27:08 +01:00

14 lines
410 B
TypeScript

import { UserType } from "@/package-shared/types";
import React from "react";
export default function useLocalUser() {
const [user, setUser] = React.useState<UserType | undefined>();
React.useEffect(() => {
try {
const localUserJSON = localStorage.getItem("user");
setUser(JSON.parse(localUserJSON || ""));
} catch (error) {}
}, []);
return { user };
}