feat: additional cookbook features (tags, tools, and public) (#1116)

* migration: add public, tags, and tools

* generate frontend types

* add help icon

* start replacement for tool-tag-category selector

* add help icon utility

* use generator types

* add support for cookbook features

* add UI elements for cookbook features

* fix tests

* fix type error
This commit is contained in:
Hayden 2022-04-01 09:50:31 -08:00 committed by GitHub
parent 1092e0ce7c
commit cfaac2e060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 374 additions and 97 deletions

View file

@ -1,9 +1,9 @@
import { useAsync, ref, Ref } from "@nuxtjs/composition-api";
import { useAsyncKey } from "./use-utils";
import { useUserApi } from "~/composables/api";
import { CookBook } from "~/api/class-interfaces/group-cookbooks";
import { ReadCookBook, RecipeCookBook, UpdateCookBook } from "~/types/api-types/cookbook";
let cookbookStore: Ref<CookBook[] | null> | null = null;
let cookbookStore: Ref<ReadCookBook[] | null> | null = null;
export const useCookbook = function () {
function getOne(id: string | number) {
@ -60,13 +60,13 @@ export const useCookbooks = function () {
loading.value = false;
},
async updateOne(updateData: CookBook) {
async updateOne(updateData: UpdateCookBook) {
if (!updateData.id) {
return;
}
loading.value = true;
const { data } = await api.cookbooks.updateOne(updateData.id, updateData);
const { data } = await api.cookbooks.updateOne(updateData.id, updateData as RecipeCookBook);
if (data && cookbookStore?.value) {
this.refreshAll();
}