mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
Consolidate frontend types (#1245)
This commit is contained in:
parent
6a88a59981
commit
479900e912
74 changed files with 261 additions and 582 deletions
|
@ -38,10 +38,10 @@
|
|||
</v-expansion-panels>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from "@nuxtjs/composition-api";
|
||||
import { ServerTask } from "~/api/types/server-task";
|
||||
import { ServerTask } from "~/types/api-types/server";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -84,4 +84,4 @@ export default defineComponent({
|
|||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -28,8 +28,8 @@ import { defineComponent, useRoute, onMounted, ref } from "@nuxtjs/composition-a
|
|||
import GroupPreferencesEditor from "~/components/Domain/Group/GroupPreferencesEditor.vue";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
import { alert } from "~/composables/use-toast";
|
||||
import { GroupInDB } from "~/types/api-types/user";
|
||||
import { VForm } from "~/types/vuetify";
|
||||
import { GroupRead } from "~/api/admin/admin-groups";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -48,7 +48,7 @@ export default defineComponent({
|
|||
|
||||
const adminApi = useAdminApi();
|
||||
|
||||
const group = ref<GroupRead | null>(null);
|
||||
const group = ref<GroupInDB | null>(null);
|
||||
|
||||
const userError = ref(false);
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, toRefs, useContext, useRouter } from "@nuxtjs/composition-api";
|
||||
import { Group } from "~/api/class-interfaces/groups";
|
||||
import { fieldTypes } from "~/composables/forms";
|
||||
import { useGroups } from "~/composables/use-groups";
|
||||
import { GroupInDB } from "~/types/api-types/user";
|
||||
|
||||
export default defineComponent({
|
||||
layout: "admin",
|
||||
|
@ -121,7 +121,7 @@ export default defineComponent({
|
|||
|
||||
const router = useRouter();
|
||||
|
||||
function handleRowClick(item: Group) {
|
||||
function handleRowClick(item: GroupInDB) {
|
||||
router.push(`/admin/manage/groups/${item.id}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,11 @@
|
|||
</v-container>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, ref, toRefs } from "@nuxtjs/composition-api";
|
||||
import { Confidence, Parser } from "~/api/class-interfaces/recipes/types";
|
||||
import { Parser } from "~/api/class-interfaces/recipes/recipe";
|
||||
import { IngredientConfidence } from "~/types/api-types/recipe";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
|
||||
type ConfidenceAttribute = "average" | "comment" | "name" | "unit" | "quantity" | "food";
|
||||
|
@ -85,7 +86,7 @@ export default defineComponent({
|
|||
parser: "nlp" as Parser,
|
||||
});
|
||||
|
||||
const confidence = ref<Confidence>({});
|
||||
const confidence = ref<IngredientConfidence>({});
|
||||
|
||||
function getColor(attribute: ConfidenceAttribute) {
|
||||
const percentage = getConfidence(attribute);
|
||||
|
@ -141,7 +142,8 @@ export default defineComponent({
|
|||
if (data) {
|
||||
state.results = true;
|
||||
|
||||
confidence.value = data.confidence;
|
||||
if (data.confidence)
|
||||
confidence.value = data.confidence;
|
||||
|
||||
// TODO: Remove ts-ignore
|
||||
// ts-ignore because data will likely change significantly once I figure out how to return results
|
||||
|
@ -215,6 +217,6 @@ export default defineComponent({
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -259,7 +259,7 @@ export default defineComponent({
|
|||
const { data } = await adminApi.about.checkApp();
|
||||
|
||||
if (data) {
|
||||
appConfig.value = data;
|
||||
appConfig.value = { ...data, isSiteSecure: false};
|
||||
}
|
||||
|
||||
appConfig.value.isSiteSecure = isLocalHostOrHttps();
|
||||
|
@ -323,7 +323,7 @@ export default defineComponent({
|
|||
if (data.success) {
|
||||
state.success = true;
|
||||
} else {
|
||||
state.error = data.error;
|
||||
state.error = data.error ?? "";
|
||||
state.success = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ import { useUserApi } from "~/composables/api";
|
|||
import { useRecipes, allRecipes } from "~/composables/recipes";
|
||||
import { Recipe } from "~/types/api-types/recipe";
|
||||
import GroupExportData from "~/components/Domain/Group/GroupExportData.vue";
|
||||
import { GroupDataExport } from "~/api/class-interfaces/recipe-bulk-actions";
|
||||
import { GroupDataExport } from "~/types/api-types/group";
|
||||
import { MenuItem } from "~/components/global/BaseOverflowButton.vue";
|
||||
|
||||
const MODES = {
|
||||
|
|
|
@ -346,7 +346,7 @@ export default defineComponent({
|
|||
date: "",
|
||||
title: "",
|
||||
text: "",
|
||||
recipeId: undefined as number | undefined,
|
||||
recipeId: undefined as string | undefined,
|
||||
entryType: "dinner" as PlanEntryType,
|
||||
});
|
||||
|
||||
|
|
|
@ -66,10 +66,10 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, toRefs, useContext, computed, onMounted } from "@nuxtjs/composition-api";
|
||||
import { SupportedMigration } from "~/api/class-interfaces/group-migrations";
|
||||
import { ReportSummary } from "~/api/class-interfaces/group-reports";
|
||||
import { ReportSummary } from "~/types/api-types/reports";
|
||||
import { MenuItem } from "~/components/global/BaseOverflowButton.vue";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import { SupportedMigrations } from "~/types/api-types/group";
|
||||
|
||||
const MIGRATIONS = {
|
||||
nextcloud: "nextcloud",
|
||||
|
@ -88,7 +88,7 @@ export default defineComponent({
|
|||
addMigrationTag: false,
|
||||
loading: false,
|
||||
treeState: true,
|
||||
migrationType: MIGRATIONS.nextcloud as SupportedMigration,
|
||||
migrationType: MIGRATIONS.nextcloud as SupportedMigrations,
|
||||
fileObject: {} as File,
|
||||
reports: [] as ReportSummary[],
|
||||
});
|
||||
|
|
|
@ -702,8 +702,8 @@ export default defineComponent({
|
|||
return;
|
||||
}
|
||||
const newVersion = await api.recipes.updateImage(recipe.value.slug, fileObject);
|
||||
if (newVersion?.data?.version) {
|
||||
recipe.value.image = newVersion.data.version;
|
||||
if (newVersion?.data?.image) {
|
||||
recipe.value.image = newVersion.data.image;
|
||||
}
|
||||
state.imageKey++;
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@
|
|||
<script lang="ts">
|
||||
import { defineComponent, ref, useRoute, useRouter } from "@nuxtjs/composition-api";
|
||||
import { invoke, until } from "@vueuse/core";
|
||||
import { ParsedIngredient, Parser } from "~/api/class-interfaces/recipes/types";
|
||||
import { CreateIngredientFood, CreateIngredientUnit, IngredientFood, IngredientUnit } from "~/types/api-types/recipe";
|
||||
import { Parser } from "~/api/class-interfaces/recipes/recipe";
|
||||
import { CreateIngredientFood, CreateIngredientUnit, IngredientFood, IngredientUnit, ParsedIngredient } from "~/types/api-types/recipe";
|
||||
import RecipeIngredientEditor from "~/components/Domain/Recipe/RecipeIngredientEditor.vue";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import { useFoods, useRecipe, useUnits } from "~/composables/recipes";
|
||||
|
|
|
@ -111,7 +111,7 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
async function deleteToken(id: string | number) {
|
||||
async function deleteToken(id: number) {
|
||||
const { data } = await api.users.deleteAPIToken(id);
|
||||
nuxtContext.$auth.fetchUser();
|
||||
return data;
|
||||
|
@ -126,4 +126,3 @@ export default defineComponent({
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue