This commit is contained in:
12
lib/api.ts
12
lib/api.ts
@@ -35,11 +35,23 @@ export const chemicalsApi = {
|
||||
remove: (id: string): Promise<void> =>
|
||||
apiFetch(`/api/chemicals/${id}`, { method: 'DELETE' }).then(() => undefined),
|
||||
|
||||
bulkRemove: (ids: string[]): Promise<void> =>
|
||||
apiFetch('/api/chemicals/bulk-delete', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ ids })
|
||||
}).then(() => undefined),
|
||||
|
||||
import: (rows: Partial<ChemicalInventory>[]): Promise<{ imported: number; errors: string[] }> =>
|
||||
apiFetch('/api/chemicals/import', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ rows }),
|
||||
}).then(r => r.json()),
|
||||
|
||||
columnMatch: (headers: string[], sampleRows: string[][]): Promise<{ mappings: { header: string; key: string; confidence: number; reason: string }[] }> =>
|
||||
apiFetch('/api/chemicals/column-match', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ headers, sampleRows }),
|
||||
}).then(r => r.json()),
|
||||
};
|
||||
|
||||
export const protocolsApi = {
|
||||
|
||||
Reference in New Issue
Block a user