From 11b7197c49a7a75c8c94a897999f0e86627d25ca Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Fri, 8 Jan 2021 15:18:08 -0700 Subject: [PATCH] admin(ui): add mising update requests --- .../scripts/api/admin/locations/updateLocation.ts | 12 ++++++++++++ resources/scripts/api/admin/mounts/updateMount.ts | 12 ++++++++++++ resources/scripts/api/admin/roles/updateRole.ts | 12 ++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 resources/scripts/api/admin/locations/updateLocation.ts create mode 100644 resources/scripts/api/admin/mounts/updateMount.ts create mode 100644 resources/scripts/api/admin/roles/updateRole.ts diff --git a/resources/scripts/api/admin/locations/updateLocation.ts b/resources/scripts/api/admin/locations/updateLocation.ts new file mode 100644 index 000000000..2ac5ea346 --- /dev/null +++ b/resources/scripts/api/admin/locations/updateLocation.ts @@ -0,0 +1,12 @@ +import http from '@/api/http'; +import { Location, rawDataToLocation } from '@/api/admin/locations/getLocations'; + +export default (id: number, short: string, long?: string): Promise => { + return new Promise((resolve, reject) => { + http.patch(`/api/application/locations/${id}`, { + short, long, + }) + .then(({ data }) => resolve(rawDataToLocation(data))) + .catch(reject); + }); +}; diff --git a/resources/scripts/api/admin/mounts/updateMount.ts b/resources/scripts/api/admin/mounts/updateMount.ts new file mode 100644 index 000000000..b3472809f --- /dev/null +++ b/resources/scripts/api/admin/mounts/updateMount.ts @@ -0,0 +1,12 @@ +import http from '@/api/http'; +import { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts'; + +export default (id: number, name: string, description: string, source: string, target: string, readOnly: boolean, userMountable: boolean): Promise => { + return new Promise((resolve, reject) => { + http.patch(`/api/application/mounts/${id}`, { + name, description, source, target, read_only: readOnly, user_mountable: userMountable, + }) + .then(({ data }) => resolve(rawDataToMount(data))) + .catch(reject); + }); +}; diff --git a/resources/scripts/api/admin/roles/updateRole.ts b/resources/scripts/api/admin/roles/updateRole.ts new file mode 100644 index 000000000..43558073f --- /dev/null +++ b/resources/scripts/api/admin/roles/updateRole.ts @@ -0,0 +1,12 @@ +import http from '@/api/http'; +import { Role, rawDataToRole } from '@/api/admin/roles/getRoles'; + +export default (id: number, name: string, description?: string): Promise => { + return new Promise((resolve, reject) => { + http.patch(`/api/application/roles/${id}`, { + name, description, + }) + .then(({ data }) => resolve(rawDataToRole(data))) + .catch(reject); + }); +};