ui(admin): implement basic egg importing

This commit is contained in:
Matthew Penner 2021-09-17 13:48:20 -06:00
parent 107cf72269
commit e8ddadc608
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F
8 changed files with 163 additions and 22 deletions

View file

@ -0,0 +1,17 @@
import http from '@/api/http';
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
export default (id: number, content: any, type = 'application/json', include: string[] = []): Promise<Egg> => {
return new Promise((resolve, reject) => {
http.post(`/api/application/nests/${id}/import`, content, {
headers: {
'Content-Type': type,
},
params: {
include: include.join(','),
},
})
.then(({ data }) => resolve(rawDataToEgg(data)))
.catch(reject);
});
};