mirror of
https://github.com/lordmathis/lemma.git
synced 2025-12-23 18:14:22 +00:00
Refactor types
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import type { User } from '@/types/authApi';
|
||||
import { API_BASE_URL, isUser } from '@/types/authApi';
|
||||
import { API_BASE_URL, type UpdateProfileRequest } from '@/types/api';
|
||||
import { isUser, type User } from '@/types/models';
|
||||
import { apiCall } from './api';
|
||||
import type { UpdateProfileRequest } from '@/types/userApi';
|
||||
|
||||
/**
|
||||
* updateProfile updates the user's profile information.
|
||||
@@ -16,12 +15,12 @@ export const updateProfile = async (
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(updateRequest),
|
||||
});
|
||||
const data = response.json();
|
||||
const data: unknown = response.json();
|
||||
|
||||
if (!isUser(data)) {
|
||||
throw new Error('Invalid user data');
|
||||
}
|
||||
return data as User;
|
||||
return data;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user