chore: run prettier

This commit is contained in:
Matthew Penner 2023-01-12 12:31:47 -07:00
parent 9cdbbc3a00
commit 155d7bb876
No known key found for this signature in database
76 changed files with 788 additions and 550 deletions

View file

@ -3,9 +3,14 @@ import { Nest, rawDataToNest } from '@/api/admin/nests/getNests';
export default (name: string, description: string | null, include: string[] = []): Promise<Nest> => {
return new Promise((resolve, reject) => {
http.post('/api/application/nests', {
name, description,
}, { params: { include: include.join(',') } })
http.post(
'/api/application/nests',
{
name,
description,
},
{ params: { include: include.join(',') } },
)
.then(({ data }) => resolve(rawDataToNest(data)))
.catch(reject);
});

View file

@ -27,12 +27,14 @@ export default (nestId: number, include: string[] = []) => {
params.sort = (sortDirection ? '-' : '') + sort;
}
return useSWR<PaginatedResult<Egg>>([ nestId, 'eggs', page, filters, sort, sortDirection ], async () => {
const { data } = await http.get(`/api/application/nests/${nestId}/eggs`, { params: { include: include.join(','), page, ...params } });
return useSWR<PaginatedResult<Egg>>([nestId, 'eggs', page, filters, sort, sortDirection], async () => {
const { data } = await http.get(`/api/application/nests/${nestId}/eggs`, {
params: { include: include.join(','), page, ...params },
});
return ({
return {
items: (data.data || []).map(rawDataToEgg),
pagination: getPaginationSet(data.meta.pagination),
});
};
});
};

View file

@ -15,7 +15,7 @@ export interface Nest {
relations: {
eggs: Egg[] | undefined;
},
};
}
export const rawDataToNest = ({ attributes }: FractalResponseData): Nest => ({
@ -55,12 +55,14 @@ export default (include: string[] = []) => {
params.sort = (sortDirection ? '-' : '') + sort;
}
return useSWR<PaginatedResult<Nest>>([ 'nests', page, filters, sort, sortDirection ], async () => {
const { data } = await http.get('/api/application/nests', { params: { include: include.join(','), page, ...params } });
return useSWR<PaginatedResult<Nest>>(['nests', page, filters, sort, sortDirection], async () => {
const { data } = await http.get('/api/application/nests', {
params: { include: include.join(','), page, ...params },
});
return ({
return {
items: (data.data || []).map(rawDataToNest),
pagination: getPaginationSet(data.meta.pagination),
});
};
});
};

View file

@ -3,9 +3,14 @@ import { Nest, rawDataToNest } from '@/api/admin/nests/getNests';
export default (id: number, name: string, description: string | null, include: string[] = []): Promise<Nest> => {
return new Promise((resolve, reject) => {
http.patch(`/api/application/nests/${id}`, {
name, description,
}, { params: { include: include.join(',') } })
http.patch(
`/api/application/nests/${id}`,
{
name,
description,
},
{ params: { include: include.join(',') } },
)
.then(({ data }) => resolve(rawDataToNest(data)))
.catch(reject);
});