MCPcopy Create free account
hub / github.com/bsoc-bitbyte/busify / ValidateAuth

Function ValidateAuth

frontend/src/components/ValidateAuth.tsx:5–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import axios from 'axios';
4
5const ValidateAuth: React.FC = () => {
6 const {setIsAuth, setUser, setIsLoading} = useAuthStore();
7 useEffect(() => {
8 const checkAuth = async () => {
9 try {
10 const res = await axios.get(
11 `${import.meta.env.VITE_SERVER_URL}/auth/me`,
12 {
13 withCredentials: true,
14 }
15 );
16 if (res.status === 200) {
17 setIsAuth(true);
18 setUser(res.data);
19 setIsLoading(false);
20 }
21 } catch (error) {
22 setIsLoading(false);
23 }
24 };
25 checkAuth();
26 }, [setIsAuth, setIsLoading, setUser]);
27 return <></>;
28};
29export default ValidateAuth;

Callers

nothing calls this directly

Calls 1

checkAuthFunction · 0.85

Tested by

no test coverage detected