prod 2 up
This commit is contained in:
parent
cf8904d475
commit
247c0b831f
@ -67,13 +67,24 @@ const Forms = () => {
|
|||||||
async function openFormView(formId) {
|
async function openFormView(formId) {
|
||||||
const response = await listFormsByTokenApi(cookies.token, 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}/`);
|
navigate(`/forms/${response.data.tokens[0].id}/`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(response)
|
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 (
|
return (
|
||||||
<div className={classes.main}>
|
<div className={classes.main}>
|
||||||
@ -102,7 +113,7 @@ const Forms = () => {
|
|||||||
<ul class="dropdown-menu" aria-labelledby="action">
|
<ul class="dropdown-menu" aria-labelledby="action">
|
||||||
<li><a class="dropdown-item" onClick={() => openFormView(item.id)}>Открыть</a></li>
|
<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={() => 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>
|
<li><a class="dropdown-item" onClick={() => removeForm(item.id)}>Удалить</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,7 +60,6 @@ const Profile = () => {
|
|||||||
async function editUser() {
|
async function editUser() {
|
||||||
if (edit) {
|
if (edit) {
|
||||||
setEdit(!edit)
|
setEdit(!edit)
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const response = await editUserApi(cookies.token, {
|
const response = await editUserApi(cookies.token, {
|
||||||
@ -79,10 +78,10 @@ const Profile = () => {
|
|||||||
last_name: last_name,
|
last_name: last_name,
|
||||||
email: email,
|
email: email,
|
||||||
phone: phone,
|
phone: phone,
|
||||||
|
is_admin: user.is_admin
|
||||||
})
|
})
|
||||||
setEdit(!edit)
|
setEdit(!edit)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user