fix(auth): enhance user login response handling and update User schema
- Log the response data on successful login for debugging purposes - Improve error handling in user service by using safeParse for login response validation - Update User schema to allow null values for optional fields, enhancing flexibility in user data handling
This commit is contained in:
@@ -19,7 +19,11 @@ export const userService = {
|
||||
try {
|
||||
const response = await api.post(API_ENDPOINTS.USER.LOGIN, credentials);
|
||||
|
||||
return LoginResponseSchema.parse(response.data);
|
||||
const result = LoginResponseSchema.safeParse(response.data);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error.message);
|
||||
}
|
||||
return result.data;
|
||||
} catch (error) {
|
||||
console.error("ERROR caught in User Service Login:", error);
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user