mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
Merge branch 'develop' into print-resources
This commit is contained in:
42
packages/webapp/src/hooks/query/attachments.ts
Normal file
42
packages/webapp/src/hooks/query/attachments.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
// @ts-nocheck
|
||||
import { useMutation } from 'react-query';
|
||||
import useApiRequest from '../useRequest';
|
||||
|
||||
/**
|
||||
* 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,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads the given attachments.
|
||||
*/
|
||||
export function useGetPresignedUrlAttachment(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(key: string) =>
|
||||
apiRequest
|
||||
.get(`/attachments/${key}/presigned-url`)
|
||||
.then((res) => res.data),
|
||||
props,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user