- lib/api.ts (879 baris) → 13 file di lib/api/ per domain - constants/Styles.ts (1.275 baris) → 10 file di constants/styles/ per domain - tambah docs/FILE-HEALTH.md dan referensinya ke CLAUDE.md - kedua file lama tetap sebagai re-export — zero breaking changes
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import api from './client';
|
|
|
|
export const apiGetProfile = async ({ id }: { id: string }) => {
|
|
const response = await api.get(`mobile/user/${id}`);
|
|
return response.data;
|
|
};
|
|
|
|
export const apiEditProfile = async (data: FormData) => {
|
|
const response = await api.put(`/mobile/user/profile`, data, {
|
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
})
|
|
return response.data;
|
|
};
|
|
|
|
export const apiGetUser = async ({ user, active, search, group, page }: { user: string, active: string, search: string, group?: string, page?: number }) => {
|
|
const response = await api.get(`mobile/user?user=${user}&active=${active}&group=${group}&search=${search}&page=${page}`);
|
|
return response.data;
|
|
};
|
|
|
|
export const apiCreateUser = async ({ data }: { data: FormData }) => {
|
|
const response = await api.post('/mobile/user', data, {
|
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
})
|
|
return response.data;
|
|
};
|
|
|
|
export const apiDeleteUser = async (data: { user: string, isActive: boolean }, id: string) => {
|
|
const response = await api.delete(`mobile/user/${id}`, { data })
|
|
return response.data
|
|
};
|
|
|
|
export const apiToggleApprover = async (data: { user: string, isApprover: boolean }, id: string) => {
|
|
const response = await api.patch(`mobile/user/${id}`, data)
|
|
return response.data
|
|
};
|
|
|
|
export const apiEditUser = async (data: FormData, id: string) => {
|
|
const response = await api.put(`/mobile/user/${id}`, data, {
|
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
})
|
|
return response.data;
|
|
};
|