mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 14:23:44 +02:00
admin(ui-api): add 'include' parameter to all requests
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user