migration changes

This commit is contained in:
Hayden
2021-01-01 16:51:55 -09:00
parent e5304f0589
commit e313741a25
59 changed files with 368 additions and 22124 deletions

View File

@@ -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 = {

View 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;
},
};

View File

@@ -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}`);