diff --git a/utils/api.tsx b/utils/api.tsx index e1d02c37..4817829a 100644 --- a/utils/api.tsx +++ b/utils/api.tsx @@ -4,7 +4,7 @@ interface Entity { name: string } -type CollectionEndpoint = ({ query }: { query: AxiosRequestConfig }) => Promise> +type CollectionEndpoint = (headers?: {}) => Promise> type IdEndpoint = ({ id }: { id: string }) => Promise> type IdWithObjectEndpoint = ({ id, object }: { id: string, object: string }) => Promise> type PostEndpoint = (object: {}, headers?: {}) => Promise> @@ -41,7 +41,7 @@ class Api { const resourceUrl = `${this.url}/${name}` return { - getAll: ({ query }: { query: AxiosRequestConfig }) => axios.get(resourceUrl, { params: { query }}), + getAll: (headers?: {}) => axios.get(resourceUrl, headers), getOne: ({ id }: { id: string }) => axios.get(`${resourceUrl}/${id}/`), getOneWithObject: ({ id, object }: { id: string, object: string }) => axios.get(`${resourceUrl}/${id}/${object}`), create: (object: {}, headers?: {}) => axios.post(resourceUrl, object, headers), @@ -88,5 +88,6 @@ api.createEntity( { name: 'parties' }) api.createEntity( { name: 'characters' }) api.createEntity( { name: 'weapons' }) api.createEntity( { name: 'summons' }) +api.createEntity( { name: 'raids' }) export default api \ No newline at end of file