Update
This commit is contained in:
18
resources/js/modules/auth/auth-user.jsx
Normal file
18
resources/js/modules/auth/auth-user.jsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import useUserStore from '@/stores/UserStore';
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
const AuthUser = () => {
|
||||
const { auth } = usePage().props;
|
||||
const { user, fetchUser } = useUserStore();
|
||||
|
||||
useEffect(() => {
|
||||
if (auth.user) {
|
||||
if (user == null) {
|
||||
fetchUser();
|
||||
}
|
||||
}
|
||||
}, [auth.user]);
|
||||
};
|
||||
|
||||
export default AuthUser;
|
||||
Reference in New Issue
Block a user