feat: update updateUser method to use Partial<User> for improved type safety
- Refactored `updateUser` method in `admin.service.ts` to accept `Partial<User>` instead of `any`. - Added `User` type import for more precise typing.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import api from "@/lib/api";
|
import api from "@/lib/api";
|
||||||
|
import type { User } from "@/types/user";
|
||||||
import type { Report, ReportStatus } from "./report.service";
|
import type { Report, ReportStatus } from "./report.service";
|
||||||
|
|
||||||
export interface AdminStats {
|
export interface AdminStats {
|
||||||
@@ -29,7 +30,7 @@ export const adminService = {
|
|||||||
await api.delete(`/users/${userId}`);
|
await api.delete(`/users/${userId}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateUser: async (userId: string, data: any): Promise<void> => {
|
updateUser: async (userId: string, data: Partial<User>): Promise<void> => {
|
||||||
await api.patch(`/users/admin/${userId}`, data);
|
await api.patch(`/users/admin/${userId}`, data);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user