refactor: pecah lib/api.ts dan constants/Styles.ts per domain
- 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
This commit is contained in:
48
lib/api/document.api.ts
Normal file
48
lib/api/document.api.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import api from './client';
|
||||
|
||||
export const apiGetDocument = async ({ user, path, division, category }: { user: string, path: string, division: string, category: 'all' | 'folder' }) => {
|
||||
const response = await api.get(`mobile/document?user=${user}&path=${path}&division=${division}&category=${category}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiGetDocumentInformasi = async ({ user, item, cat }: { user: string, item: string, cat: 'share' | 'lainnya' }) => {
|
||||
const response = await api.get(`mobile/document/more?user=${user}&item=${item}&cat=${cat}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiDocumentRename = async (data: { name: string, user: string, id: string, path: string, idDivision: string, extension: string }) => {
|
||||
const response = await api.put(`/mobile/document`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiDocumentDelete = async (data: { user: string, data: any[] }) => {
|
||||
const response = await api.delete(`/mobile/document`, { data })
|
||||
return response.data
|
||||
};
|
||||
|
||||
export const apiCreateFolderDocument = async ({ data }: { data: { name: string, path: string, idDivision: string, user: string } }) => {
|
||||
const response = await api.post(`/mobile/document`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiUploadFileDocument = async ({ data }: { data: FormData }) => {
|
||||
const response = await api.post(`/mobile/document/upload`, data, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiMoveDocument = async (data: { path: string, dataItem: any[], user: string }) => {
|
||||
const response = await api.post(`/mobile/document/more`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiCopyDocument = async (data: { path: string, dataItem: any[], user: string, idDivision: string }) => {
|
||||
const response = await api.put(`/mobile/document/more`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiShareDocument = async (data: { dataDivision: any[], dataItem: any[], user: string }) => {
|
||||
const response = await api.delete(`/mobile/document/more`, { data })
|
||||
return response.data;
|
||||
};
|
||||
Reference in New Issue
Block a user