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 (
@@ -102,7 +113,7 @@ const Forms = () => {
diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx index 9becf6a..4a08768 100644 --- a/src/pages/Profile.jsx +++ b/src/pages/Profile.jsx @@ -60,7 +60,6 @@ const Profile = () => { async function editUser() { if (edit) { setEdit(!edit) - } else { const response = await editUserApi(cookies.token, { @@ -79,10 +78,10 @@ const Profile = () => { last_name: last_name, email: email, phone: phone, + is_admin: user.is_admin }) setEdit(!edit) - } - + } } };