use fetchWrapper for getUser.js
This commit is contained in:
@@ -12,7 +12,7 @@ export function AuthProvider({ children }) {
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const u = await getUser();
|
||||
setUser(u);
|
||||
setUser(u.data);
|
||||
setLoading(false);
|
||||
})();
|
||||
}, []);
|
||||
@@ -20,7 +20,7 @@ export function AuthProvider({ children }) {
|
||||
const login = async (email, password) => {
|
||||
const res = await loginFunction(email, password);
|
||||
const u = res.status === 200 ? await getUser() : null;
|
||||
if (u) setUser(u);
|
||||
if (u) setUser(u.data);
|
||||
return res;
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ export function AuthProvider({ children }) {
|
||||
|
||||
const update = async () => {
|
||||
const u = await getUser();
|
||||
setUser(u);
|
||||
setUser(u.data);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user