mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
api refactoring + random cleanup
This commit is contained in:
parent
c44edf97ae
commit
38e4afcc3c
11 changed files with 38 additions and 27 deletions
|
@ -1,10 +1,10 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
|
||||
const prefix = baseURL + "/recipes/categories";
|
||||
const prefix = baseURL + "categories";
|
||||
|
||||
const categoryURLs = {
|
||||
get_all: `${prefix}/all`,
|
||||
get_all: `${prefix}`,
|
||||
get_category: (category) => `${prefix}/${category}`,
|
||||
delete_category: (category) => `${prefix}/${category}`,
|
||||
};
|
||||
|
|
|
@ -2,13 +2,13 @@ import { baseURL } from "./api-utils";
|
|||
import { apiReq } from "./api-utils";
|
||||
import { store } from "../store/store";
|
||||
|
||||
const migrationBase = baseURL + "migrations/";
|
||||
const migrationBase = baseURL + "migrations";
|
||||
|
||||
const migrationURLs = {
|
||||
// New
|
||||
all: migrationBase,
|
||||
delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete/`,
|
||||
import: (folder, file) => `${migrationBase}/${folder}/${file}/import/`,
|
||||
delete: (folder, file) => `${migrationBase}/${folder}/${file}/delete`,
|
||||
import: (folder, file) => `${migrationBase}/${folder}/${file}/import`,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { baseURL } from "./api-utils";
|
||||
import { apiReq } from "./api-utils";
|
||||
|
||||
const settingsBase = baseURL + "site-settings/";
|
||||
const settingsBase = baseURL + "site-settings";
|
||||
|
||||
const settingsURLs = {
|
||||
siteSettings: `${settingsBase}`,
|
||||
updateSiteSettings: `${settingsBase}`,
|
||||
testWebhooks: `${settingsBase}webhooks/test`,
|
||||
testWebhooks: `${settingsBase}/webhooks/test`,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
class="my-3"
|
||||
:label="$t('recipe.recipe-name')"
|
||||
v-model="value.name"
|
||||
:rules="[rules.required, rules.whiteSpace]"
|
||||
:rules="[rules.required]"
|
||||
>
|
||||
</v-text-field>
|
||||
<v-textarea
|
||||
|
@ -91,7 +91,7 @@
|
|||
dense
|
||||
>
|
||||
<v-icon
|
||||
class="mr-n1"
|
||||
class="mr-n1"
|
||||
slot="prepend"
|
||||
color="error"
|
||||
@click="removeIngredient(index)"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-btn color="accent" text :href="`/api/backups/${name}/download/`">
|
||||
<v-btn color="accent" text :href="`/api/backups/${name}/download`">
|
||||
{{ $t("general.download") }}
|
||||
</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<v-row dense>
|
||||
<v-col
|
||||
:sm="6"
|
||||
:sm="12"
|
||||
:md="6"
|
||||
:lg="4"
|
||||
:xl="3"
|
||||
|
@ -78,7 +78,7 @@ export default {
|
|||
},
|
||||
async getAvailableMigrations() {
|
||||
let response = await api.migrations.getMigrations();
|
||||
response.forEach(element => {
|
||||
response.forEach((element) => {
|
||||
if (element.type === "nextcloud") {
|
||||
this.migrations.nextcloud.availableImports = element.files;
|
||||
} else if (element.type === "chowdown") {
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
"title": "Title",
|
||||
"total-time": "Total Time",
|
||||
"prep-time": "Prep Time",
|
||||
"perform-time": "Cook Time / Perform Time",
|
||||
"perform-time": "Cook Time",
|
||||
"api-extras": "API Extras",
|
||||
"object-key": "Object Key",
|
||||
"object-value": "Object Value",
|
||||
|
@ -155,4 +155,4 @@
|
|||
"description": "Migrate data from Chowdown"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
title: null,
|
||||
title: "",
|
||||
recipes: [],
|
||||
};
|
||||
},
|
||||
|
|
|
@ -143,19 +143,30 @@ export default {
|
|||
deleteRecipe() {
|
||||
api.recipes.delete(this.recipeDetails.slug);
|
||||
},
|
||||
validateRecipe() {
|
||||
if (this.jsonEditor) {
|
||||
return true;
|
||||
} else {
|
||||
return this.$refs.recipeEditor.validateRecipe();
|
||||
}
|
||||
},
|
||||
async saveRecipe() {
|
||||
if (this.$refs.recipeEditor.validateRecipe()) {
|
||||
console.log("Thank you");
|
||||
}
|
||||
let slug = await api.recipes.update(this.recipeDetails);
|
||||
if (this.validateRecipe()) {
|
||||
let slug = await api.recipes.update(this.recipeDetails);
|
||||
|
||||
if (this.fileObject) {
|
||||
await api.recipes.updateImage(this.recipeDetails.slug, this.fileObject);
|
||||
}
|
||||
if (this.fileObject) {
|
||||
await api.recipes.updateImage(
|
||||
this.recipeDetails.slug,
|
||||
this.fileObject
|
||||
);
|
||||
}
|
||||
|
||||
this.form = false;
|
||||
this.imageKey += 1;
|
||||
this.$router.push(`/recipe/${slug}`);
|
||||
this.form = false;
|
||||
this.imageKey += 1;
|
||||
if (slug != this.recipeDetails.slug) {
|
||||
this.$router.push(`/recipe/${slug}`);
|
||||
}
|
||||
}
|
||||
},
|
||||
showForm() {
|
||||
this.form = true;
|
||||
|
|
|
@ -43,7 +43,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
searchResults: null,
|
||||
searchResults: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -43,7 +43,7 @@ const monthsShort = [
|
|||
|
||||
export default {
|
||||
getImageURL(image) {
|
||||
return `/api/recipe/image/${image}/`;
|
||||
return `/api/recipes/${image}/image`;
|
||||
},
|
||||
generateUniqueKey(item, index) {
|
||||
const uniqueKey = `${item}-${index}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue