diff --git a/src/utils/api.tsx b/src/utils/api.tsx index e829180d..9f63b81b 100644 --- a/src/utils/api.tsx +++ b/src/utils/api.tsx @@ -6,7 +6,7 @@ interface Entity { type CollectionEndpoint = ({ query }: { query: AxiosRequestConfig }) => Promise> type IdEndpoint = ({ id }: { id: string }) => Promise> -type PostEndpoint = (object: {}) => Promise> +type PostEndpoint = (object: {}, headers?: {}) => Promise> interface EndpointMap { getAll: CollectionEndpoint @@ -39,8 +39,8 @@ class Api { return { getAll: ({ query }: { query: AxiosRequestConfig }) => axios.get(resourceUrl, { params: { query }}), getOne: ({ id }: { id: string }) => axios.get(`${resourceUrl}/${id}`), - create: (object: {}) => axios.post(resourceUrl, object), - update: (object: {}) => axios.put(resourceUrl, object), + create: (object: {}, headers?: {}) => axios.post(resourceUrl, object, headers), + update: (object: {}, headers?: {}) => axios.put(resourceUrl, object, headers), destroy: ({ id }: { id: string }) => axios.delete(`${resourceUrl}/${id}`) } as EndpointMap }