2020-04-04 18:59:25 +01:00
|
|
|
import http from '@/api/http';
|
2020-08-21 05:44:33 +01:00
|
|
|
import { ServerBackup } from '@/api/server/types';
|
2020-08-22 23:46:13 +01:00
|
|
|
import { rawDataToServerBackup } from '@/api/transformers';
|
2020-04-04 18:59:25 +01:00
|
|
|
|
2020-04-19 07:26:59 +01:00
|
|
|
export default (uuid: string, name?: string, ignored?: string): Promise<ServerBackup> => {
|
2020-04-04 18:59:25 +01:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
http.post(`/api/client/servers/${uuid}/backups`, {
|
2020-04-19 07:26:59 +01:00
|
|
|
name, ignored,
|
2020-04-04 18:59:25 +01:00
|
|
|
})
|
2020-04-04 20:26:39 +01:00
|
|
|
.then(({ data }) => resolve(rawDataToServerBackup(data)))
|
2020-04-04 18:59:25 +01:00
|
|
|
.catch(reject);
|
|
|
|
});
|
|
|
|
};
|