2021-01-06 23:38:39 +00:00
|
|
|
import http from '@/api/http';
|
|
|
|
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
|
|
|
|
|
2021-01-15 16:41:15 +00:00
|
|
|
export default (name: string, description: string | null, include: string[] = []): Promise<Node> => {
|
2021-01-06 23:38:39 +00:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.post('/api/application/nodes', {
|
|
|
|
name, description,
|
2021-01-15 16:41:15 +00:00
|
|
|
}, { params: { include: include.join(',') } })
|
2021-01-06 23:38:39 +00:00
|
|
|
.then(({ data }) => resolve(rawDataToNode(data)))
|
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|