-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Describe the bug
i have just copied from the docs directly and used it like below the the user key value is not set on the localStorage, and i do not even think this library works?
here is the version "use-local-storage": "^3.0.0",
here is the code
export default function Login() {
const [user, setUser] = useLocalStorage("user",{});
async function onSubmit(values: z.infer<typeof formSchema>) {
try {
const { userId, password } = values;
const response = await axios.get(
`${
import.meta.env.VITE_BASE_API
}/Login/SignIn?UidCod=${userId}&UidPwd=${password}`
);
console.log(response.data)
if (response.statusText === "OK") {
setUser(response.data);
navigate("/out_patient");
return;
}
} catch (err) {
console.log(err);
}
}
return (<>It does not work I should just stick to the localStorage API or built my own or use another one!</>);
}
monolithed
Metadata
Metadata
Assignees
Labels
No labels