mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-22 22:59:41 +02:00
init 2
This commit is contained in:
commit
beed8576c2
137 changed files with 40218 additions and 0 deletions
37
frontend/src/api/backup.js
Normal file
37
frontend/src/api/backup.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
import { store } from "../store/store";
|
||||
|
||||
const backupBase = baseURL + "backups/";
|
||||
|
||||
const backupURLs = {
|
||||
// Backup
|
||||
avaiable: `${backupBase}avaiable/`,
|
||||
createBackup: `${backupBase}export/database/`,
|
||||
importBackup: (fileName) => `${backupBase}${fileName}/import/`,
|
||||
deleteBackup: (fileName) => `${backupBase}${fileName}/delete/`,
|
||||
};
|
||||
|
||||
export default {
|
||||
async requestAvailable() {
|
||||
let response = await apiReq.get(backupURLs.avaiable);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
async import(fileName) {
|
||||
apiReq.post(backupURLs.importBackup(fileName));
|
||||
store.dispatch("requestRecentRecipes");
|
||||
},
|
||||
|
||||
async delete(fileName) {
|
||||
await apiReq.delete(backupURLs.deleteBackup(fileName));
|
||||
},
|
||||
|
||||
async create(tag, template) {
|
||||
let response = apiReq.post(backupURLs.createBackup, {
|
||||
tag: tag,
|
||||
template: template,
|
||||
});
|
||||
return response;
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue