mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat: wip UI attachments
This commit is contained in:
31
packages/webapp/src/hooks/query/attachments.ts
Normal file
31
packages/webapp/src/hooks/query/attachments.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// @ts-nocheck
|
||||
import { useMutation } from 'react-query';
|
||||
import useApiRequest from '../useRequest';
|
||||
|
||||
const commonInvalidateQueries = (query) => {
|
||||
// Invalidate accounts.
|
||||
};
|
||||
|
||||
/**
|
||||
* Uploads the given attachments.
|
||||
*/
|
||||
export function useUploadAttachments(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(values) => apiRequest.post('/attachments', values),
|
||||
props,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given attachment key.
|
||||
*/
|
||||
export function useDeleteAttachment(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(key: string) => apiRequest.delete(`/attachments/${key}`),
|
||||
props,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user