2021-01-01 16:51:55 -09:00
|
|
|
import { baseURL } from "./api-utils";
|
|
|
|
import { apiReq } from "./api-utils";
|
|
|
|
import { store } from "../store/store";
|
|
|
|
|
|
|
|
const migrationBase = baseURL + "migration/";
|
|
|
|
|
|
|
|
const migrationURLs = {
|
|
|
|
chowdownURL: migrationBase + "chowdown/repo/",
|
2021-01-09 18:04:53 -09:00
|
|
|
nextcloudAvaiable: migrationBase + "nextcloud/available/",
|
|
|
|
nextcloudImport: (selection) =>
|
|
|
|
`${migrationBase}nextcloud/${selection}/import/`,
|
|
|
|
nextcloudDelete: (selection) =>
|
|
|
|
`${migrationBase}nextcloud/${selection}/delete/`,
|
2021-01-01 16:51:55 -09:00
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
async migrateChowdown(repoURL) {
|
|
|
|
let postBody = { url: repoURL };
|
|
|
|
let response = await apiReq.post(migrationURLs.chowdownURL, postBody);
|
|
|
|
store.dispatch("requestRecentRecipes");
|
|
|
|
return response.data;
|
|
|
|
},
|
2021-01-09 18:04:53 -09:00
|
|
|
async getNextcloudImports() {
|
|
|
|
let response = await apiReq.get(migrationURLs.nextcloudAvaiable);
|
|
|
|
return response.data;
|
|
|
|
},
|
|
|
|
async importNextcloud(selected) {
|
|
|
|
let response = await apiReq.post(migrationURLs.nextcloudImport(selected));
|
|
|
|
return response.data;
|
|
|
|
},
|
2021-01-01 16:51:55 -09:00
|
|
|
};
|