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