1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-19 13:19:41 +02:00
mealie/frontend/src/api/migration.js
Hayden be378cb20c
feature/recipe-patch-improvements (#382)
* automated docs update

* recipe rating component

* recipe partial updates - closes #25

* use Vue.delete to update store

* format

* arrow functions

* fix tests

* format

* initial context menu

* localize

* add confirmation dialog

* context menu

* fix bare exception

* update line length

* format all file with prettier

* update changelog

* download as json

* update python dependencies

* update javascript dependencies

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-05-01 20:46:02 -08:00

34 lines
988 B
JavaScript

import { baseURL } from "./api-utils";
import { apiReq } from "./api-utils";
import { store } from "../store";
import i18n from "@/i18n.js";
const migrationBase = baseURL + "migrations";
const migrationURLs = {
// New
all: migrationBase,
delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete`,
import: (folder, file) => `${migrationBase}/${folder}/${file}/import`,
};
export const migrationAPI = {
async getMigrations() {
let response = await apiReq.get(migrationURLs.all);
return response.data;
},
async delete(folder, file) {
const response = await apiReq.delete(
migrationURLs.delete(folder, file),
null,
() => i18n.t("general.file-folder-not-found"),
() => i18n.t("migration.migration-data-removed")
);
return response;
},
async import(folder, file) {
let response = await apiReq.post(migrationURLs.import(folder, file));
store.dispatch("requestRecentRecipes");
return response.data;
},
};