prod 2 up

This commit is contained in:
kuwsh1n 2024-04-13 22:04:32 +03:00
parent cf8904d475
commit 247c0b831f
2 changed files with 16 additions and 6 deletions

View File

@ -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 (
<div className={classes.main}>
@ -102,7 +113,7 @@ const Forms = () => {
<ul class="dropdown-menu" aria-labelledby="action">
<li><a class="dropdown-item" onClick={() => openFormView(item.id)}>Открыть</a></li>
<li><a class="dropdown-item" onClick={() => navigate(`/forms/${item.id}/answers`)}>Ответы</a></li>
<li><a class="dropdown-item" onClick={() => navigator.clipboard.writeText(`http://localhost:3000/forms/${item.id}/`)}>Скопировать ссылку</a></li>
<li><a class="dropdown-item" onClick={() => copyLinkToFormView(item.id)}>Скопировать ссылку</a></li>
<li><a class="dropdown-item" onClick={() => removeForm(item.id)}>Удалить</a></li>
</ul>
</div>

View File

@ -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)
}
}
}
};