admin(ui-api): add 'include' parameter to all requests

This commit is contained in:
Matthew Penner 2021-01-15 09:41:15 -07:00
parent e123367f40
commit 9532ecf867
24 changed files with 48 additions and 48 deletions

View file

@ -1,11 +1,11 @@
import http from '@/api/http';
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
export default (name: string, description?: string): Promise<Node> => {
export default (name: string, description: string | null, include: string[] = []): Promise<Node> => {
return new Promise((resolve, reject) => {
http.post('/api/application/nodes', {
name, description,
})
}, { params: { include: include.join(',') } })
.then(({ data }) => resolve(rawDataToNode(data)))
.catch(reject);
});

View file

@ -1,9 +1,9 @@
import http from '@/api/http';
import { Node, rawDataToNode } from '@/api/admin/nodes/getNodes';
export default (id: number): Promise<Node> => {
export default (id: number, include: string[] = []): Promise<Node> => {
return new Promise((resolve, reject) => {
http.get(`/api/application/nodes/${id}`)
http.get(`/api/application/nodes/${id}`, { params: { include: include.join(',') } })
.then(({ data }) => resolve(rawDataToNode(data)))
.catch(reject);
});