mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-19 02:12:48 -05:00
migration changes
This commit is contained in:
@@ -2,13 +2,17 @@ const baseURL = "/api/";
|
||||
import axios from "axios";
|
||||
import store from "../store/store";
|
||||
|
||||
// look for data.snackbar in response
|
||||
function processResponse(response) {
|
||||
if (("data" in response) & ("snackbar" in response.data)) {
|
||||
try {
|
||||
store.commit("setSnackBar", {
|
||||
text: response.data.snackbar.text,
|
||||
type: response.data.snackbar.type,
|
||||
});
|
||||
} else return;
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const apiReq = {
|
||||
|
||||
19
frontend/src/api/migration.js
Normal file
19
frontend/src/api/migration.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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/",
|
||||
};
|
||||
|
||||
export default {
|
||||
async migrateChowdown(repoURL) {
|
||||
let postBody = { url: repoURL };
|
||||
let response = await apiReq.post(migrationURLs.chowdownURL, postBody);
|
||||
console.log(response);
|
||||
store.dispatch("requestRecentRecipes");
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
@@ -20,7 +20,10 @@ const recipeURLs = {
|
||||
|
||||
export default {
|
||||
async createByURL(recipeURL) {
|
||||
let response = await apiReq.post(recipeURLs.createByURL, { url: recipeURL });
|
||||
let response = await apiReq.post(recipeURLs.createByURL, {
|
||||
url: recipeURL,
|
||||
});
|
||||
console.log(response);
|
||||
let recipeSlug = response.data;
|
||||
store.dispatch("requestRecentRecipes");
|
||||
router.push(`/recipe/${recipeSlug}`);
|
||||
|
||||
Reference in New Issue
Block a user