Compare commits
No commits in common. "a0acd0fd4660808f80c2af686a4e21e347c8f696" and "38098ea671daa10a11440d791fca2961350dcccc" have entirely different histories.
a0acd0fd46
...
38098ea671
@ -1,14 +1,15 @@
|
||||
import { useState } from "react";
|
||||
import { EngagementShareRecipe } from "../../services/EngagementService";
|
||||
import { isApiError } from "../../types/api/error";
|
||||
import { GetBackendUrl } from "../../services/environment";
|
||||
import ROUTE_CONSTANTS from "../../types/routes";
|
||||
|
||||
|
||||
interface ShareButtonProps {
|
||||
id: number;
|
||||
}
|
||||
|
||||
// TODO: Abstract this somehow, this needs to be loaded from the env
|
||||
const DOMAIN = "http://localhost:5173/";
|
||||
|
||||
export default function ShareButton({ id }: ShareButtonProps) {
|
||||
const [clicked, setClicked] = useState<boolean>(false);
|
||||
|
||||
@ -16,8 +17,7 @@ export default function ShareButton({ id }: ShareButtonProps) {
|
||||
if (clicked) return;
|
||||
|
||||
// Copy first, so it feels fast
|
||||
const url = `${GetBackendUrl()}${ROUTE_CONSTANTS.Recipe(id)}`;
|
||||
await navigator.clipboard.writeText(url);
|
||||
await navigator.clipboard.writeText(`${DOMAIN}/v2/web/recipe/${id}`)
|
||||
|
||||
const result = await EngagementShareRecipe(id);
|
||||
if (isApiError(result)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user