2022-12-16 02:06:14 +00:00
|
|
|
import http from '@/api/http';
|
|
|
|
import { Mount, rawDataToMount } from '@/api/admin/mounts/getMounts';
|
|
|
|
|
2023-01-12 19:31:47 +00:00
|
|
|
export default (
|
|
|
|
name: string,
|
|
|
|
description: string,
|
|
|
|
source: string,
|
|
|
|
target: string,
|
|
|
|
readOnly: boolean,
|
|
|
|
userMountable: boolean,
|
|
|
|
include: string[] = [],
|
|
|
|
): Promise<Mount> => {
|
2022-12-16 02:06:14 +00:00
|
|
|
return new Promise((resolve, reject) => {
|
2023-01-12 19:31:47 +00:00
|
|
|
http.post(
|
|
|
|
'/api/application/mounts',
|
|
|
|
{
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
source,
|
|
|
|
target,
|
|
|
|
read_only: readOnly,
|
|
|
|
user_mountable: userMountable,
|
|
|
|
},
|
|
|
|
{ params: { include: include.join(',') } },
|
|
|
|
)
|
2022-12-16 02:06:14 +00:00
|
|
|
.then(({ data }) => resolve(rawDataToMount(data)))
|
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|