import { apiRequest } from '@/utils/api/apiRequest'; export const login = async (email: string, password: string) => { const data = await apiRequest.post('/api/auth/login', { email, password }); if (!data.access_token) { throw new Error('No access token returned from login.'); } localStorage.setItem('token', data.access_token); return data; }; export const register = async (name: string, email: string, password: string, passwordConfirmation: string) => { const data = await apiRequest.post('/api/auth/register', { name, email, password, password_confirmation: passwordConfirmation, // Match the backend's expected parameter }); // Store the token (if returned by the backend) similarly to login localStorage.setItem('token', data.access_token); return data; };