feat: public recipe access (#1610)

* initial public explorer API endpoint

* public API endpoint

* cleanup recipe page

* wip: init explorer page

* use public URLs for shared recipes

* refactor private share tokens to use shared page
This commit is contained in:
Hayden
2022-08-28 20:08:33 -08:00
committed by GitHub
parent 9ea5e6584f
commit 18b2c92a76
24 changed files with 361 additions and 437 deletions

View File

@@ -1,7 +1,15 @@
import { Ref } from "@nuxtjs/composition-api";
import { Recipe } from "~/types/api-types/recipe";
export const useRecipeMeta = (recipe: Ref<Recipe | null>) => {
export interface RecipeMeta {
title?: string;
metaImage?: string;
meta: Array<any>;
__dangerouslyDisableSanitizers: Array<string>;
script: Array<any>;
}
export const useRecipeMeta = (recipe: Ref<Recipe | null>): (() => RecipeMeta) => {
return () => {
const imageURL = "";
return {

View File

@@ -1,6 +1,21 @@
import { useClipboard } from "@vueuse/core";
import { alert } from "./use-toast";
export function useCopy() {
const { copy, copied, isSupported } = useClipboard();
function copyText(text: string) {
if (!isSupported) {
alert.error("Clipboard not supported");
return;
}
copy(text);
alert.success("Copied to clipboard");
}
return { copyText, copied };
}
export function useCopyList() {
const { copy, isSupported } = useClipboard();
@@ -46,4 +61,3 @@ export function useCopyList() {
copyMarkdownCheckList,
};
}