2020-12-31 17:27:16 -07:00
|
|
|
import http from '@/api/http';
|
2021-01-06 16:38:39 -07:00
|
|
|
import { Nest, rawDataToNest } from '@/api/admin/nests/getNests';
|
2020-12-31 17:27:16 -07:00
|
|
|
|
2021-01-15 09:41:15 -07:00
|
|
|
export default (name: string, description: string | null, include: string[] = []): Promise<Nest> => {
|
2020-12-31 17:27:16 -07:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.post('/api/application/nests', {
|
|
|
|
name, description,
|
2021-01-15 09:41:15 -07:00
|
|
|
}, { params: { include: include.join(',') } })
|
2021-01-06 16:38:39 -07:00
|
|
|
.then(({ data }) => resolve(rawDataToNest(data)))
|
2020-12-31 17:27:16 -07:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|