diff --git a/src/contexts/AuthContext.tsx b/src/contexts/AuthContext.tsx index 3d2c507..e709f31 100644 --- a/src/contexts/AuthContext.tsx +++ b/src/contexts/AuthContext.tsx @@ -2,9 +2,11 @@ import React, { createContext, useContext, useState, type ReactNode } from 'react'; type User = { - id?: string; - name?: string; + uid?: string; email?: string; + first_name?: string; + last_name?: string; + role?: string; }; type AuthContextType = { @@ -32,9 +34,7 @@ export const AuthProvider: React.FC = ({ children }) => { setLoading(true); const response = await fetch('https://api.capyrpi.org/v1/auth/me', { - headers: { - Accept: 'application/json', - }, + headers: { Accept: 'application/json' }, credentials: 'include', }); @@ -70,9 +70,8 @@ export const AuthProvider: React.FC = ({ children }) => { const pollInterval = setInterval(async () => { try { const response = await fetch('https://api.capyrpi.org/v1/auth/me', { - headers: { - Accept: 'application/json', - }, + headers: { Accept: 'application/json' }, + credentials: 'include', }); if (response.ok) { diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index f90ebae..c68fbe9 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -16,7 +16,8 @@ export default function Home() { setShowLogin(false)} />

- UserId: {user?.id ?? 'Not logged in'} + UserId:{' '} + {user?.uid ?? 'Not logged in'}

diff --git a/vite.config.ts b/vite.config.ts index 8b0f57b..7182207 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 5173 + } })