Updates
This commit is contained in:
parent
4776018c3c
commit
f0850146be
@ -1,25 +0,0 @@
|
|||||||
import { LocalStorageDict } from "@/dict/local-storage-dict";
|
|
||||||
import { DATASQUIREL_LoggedInUser } from "@moduletrace/datasquirel/package-shared/types";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export default function useLocalUser() {
|
|
||||||
const [user, setUser] = React.useState<
|
|
||||||
DATASQUIREL_LoggedInUser | null | undefined
|
|
||||||
>(undefined);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
try {
|
|
||||||
const localUserJSON = localStorage.getItem(
|
|
||||||
LocalStorageDict["User"]
|
|
||||||
);
|
|
||||||
if (localUserJSON) {
|
|
||||||
const localUser = JSON.parse(localUserJSON);
|
|
||||||
setUser(localUser);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
setUser(null);
|
|
||||||
}
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return { user };
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user