admin(ui-api): add 'include' parameter to all requests
This commit is contained in:
parent
e123367f40
commit
9532ecf867
24 changed files with 48 additions and 48 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue