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 { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts';
export default (name: string, description: string, source: string, target: string, readOnly: boolean, userMountable: boolean): Promise<Mount> => {
export default (name: string, description: string, source: string, target: string, readOnly: boolean, userMountable: boolean, include: string[] = []): Promise<Mount> => {
return new Promise((resolve, reject) => {
http.post('/api/application/mounts', {
name, description, source, target, read_only: readOnly, user_mountable: userMountable,
})
}, { params: { include: include.join(',') } })
.then(({ data }) => resolve(rawDataToMount(data)))
.catch(reject);
});

View file

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

View file

@ -1,11 +1,11 @@
import http from '@/api/http';
import { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts';
export default (id: number, name: string, description: string | null, source: string, target: string, readOnly: boolean, userMountable: boolean): Promise<Mount> => {
export default (id: number, name: string, description: string | null, source: string, target: string, readOnly: boolean, userMountable: boolean, include: string[] = []): Promise<Mount> => {
return new Promise((resolve, reject) => {
http.patch(`/api/application/mounts/${id}`, {
name, description, source, target, read_only: readOnly, user_mountable: userMountable,
})
}, { params: { include: include.join(',') } })
.then(({ data }) => resolve(rawDataToMount(data)))
.catch(reject);
});