diff --git a/src/pages/Forms.jsx b/src/pages/Forms.jsx index e05e0df..e3caf63 100644 --- a/src/pages/Forms.jsx +++ b/src/pages/Forms.jsx @@ -67,13 +67,24 @@ const Forms = () => { async function openFormView(formId) { const response = await listFormsByTokenApi(cookies.token, formId); - if (response.status === 200) { + if (response.status === 200 && response.data.tokens) { navigate(`/forms/${response.data.tokens[0].id}/`); } else { console.log(response) } - } + }; + + async function copyLinkToFormView(formId) { + const response = await listFormsByTokenApi(cookies.token, formId); + + if (response.status === 200 && response.data.tokens) { + navigator.clipboard.writeText(`http://localhost:3000/forms/${response.data.tokens[0].id}/`) + } + else { + console.log(response) + } + }; return (