Новый функционал входа и выхода в мобильном меню
This commit is contained in:
parent
f3dbfb3587
commit
2f57bf91ef
5 changed files with 196 additions and 11 deletions
|
|
@ -44,8 +44,8 @@ import { COMPANY } from "@constants";
|
|||
|
||||
<div class="header-actions" id="auth-section"></div>
|
||||
|
||||
<div class="mobile-actions">
|
||||
<a href={`tel:${COMPANY.phoneClean}`} class="mobile-phone-btn" aria-label="Позони<EFBFBD><EFBFBD>ь: {COMPANY.phone}">
|
||||
<div class="mobile-actions">
|
||||
<a href={`tel:${COMPANY.phoneClean}`} class="mobile-phone-btn" aria-label="Позониь: {COMPANY.phone}">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
|
|
@ -395,8 +395,10 @@ import { COMPANY } from "@constants";
|
|||
localStorage.removeItem('user');
|
||||
localStorage.removeItem('pocketbase_auth');
|
||||
document.querySelector('.header-right')?.classList.remove('auth-active');
|
||||
// Редирект на текущую страницу
|
||||
window.location.href = window.location.pathname + window.location.search + window.location.hash;
|
||||
// Редирект на текущую страницу с параметром loggedout
|
||||
const currentUrl = window.location.pathname + window.location.search + window.location.hash;
|
||||
const separator = currentUrl.includes('?') ? '&' : '?';
|
||||
window.location.href = currentUrl + separator + 'loggedout=true';
|
||||
});
|
||||
|
||||
// Добавляем класс для изменения порядка
|
||||
|
|
@ -415,6 +417,19 @@ import { COMPANY } from "@constants";
|
|||
document.querySelector('.header-right')?.classList.remove('auth-active');
|
||||
}
|
||||
|
||||
// Проверка параметра loggedout и показ Toast
|
||||
function checkLogoutToast() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.get('loggedout') === 'true') {
|
||||
// Очистить URL без перезагрузки
|
||||
window.history.replaceState({}, '', window.location.pathname + window.location.hash);
|
||||
// Показать Toast
|
||||
setTimeout(() => {
|
||||
window.toast?.show('Вы вышли из системы', 'info', 3000);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Стили
|
||||
const authStyle = `
|
||||
.header-right.auth-active {
|
||||
|
|
@ -485,6 +500,8 @@ import { COMPANY } from "@constants";
|
|||
document.head.appendChild(styleEl);
|
||||
|
||||
initAuth();
|
||||
checkLogoutToast();
|
||||
|
||||
const animatedElements = document.querySelectorAll(".animate-load");
|
||||
|
||||
animatedElements.forEach((el) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue