fix frontend
This commit is contained in:
@@ -77,19 +77,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Notification Toast -->
|
||||
<Transition name="slide">
|
||||
<div v-if="notification.show" class="fixed bottom-4 right-4 z-50 flex items-center space-x-2 px-4 py-3 rounded-lg shadow-lg" :class="notification.type === 'success' ? 'bg-green-50 text-green-800 border border-green-200' : 'bg-red-50 text-red-800 border border-red-200'">
|
||||
<svg v-if="notification.type === 'success'" class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<svg v-else class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<span>{{ notification.message }}</span>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
@@ -112,18 +99,10 @@ const form = reactive({
|
||||
});
|
||||
|
||||
const loading = ref(false);
|
||||
const notification = ref({ show: false, type: 'success', message: '' });
|
||||
|
||||
const userInitials = computed(() => (userStore.login[0] || 'U').toUpperCase());
|
||||
const passwordMismatch = computed(() => !!form.password && form.password !== form.confirmPassword);
|
||||
|
||||
function showNotification(message: string, type: 'success' | 'error') {
|
||||
notification.value = { show: true, type, message };
|
||||
setTimeout(() => {
|
||||
notification.value.show = false;
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.email = userStore.email;
|
||||
form.password = '';
|
||||
@@ -133,7 +112,7 @@ function resetForm() {
|
||||
|
||||
async function saveProfile() {
|
||||
if (form.password && form.password !== form.confirmPassword) {
|
||||
showNotification('Passwords do not match', 'error');
|
||||
showNotification('profile.passwordsMismatch', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -149,10 +128,10 @@ async function saveProfile() {
|
||||
|
||||
if (ok) {
|
||||
locale.value = form.language;
|
||||
showNotification('Profile updated successfully', 'success');
|
||||
showNotification('profile.updateSuccess', 'success');
|
||||
resetForm(); // очищаем поля пароля
|
||||
} else {
|
||||
showNotification('Failed to update profile', 'error');
|
||||
showNotification('profile.updateError', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,15 +140,3 @@ onMounted(() => {
|
||||
form.language = userStore.language;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.slide-enter-active,
|
||||
.slide-leave-active {
|
||||
transition: transform 0.3s ease, opacity 0.3s ease;
|
||||
}
|
||||
.slide-enter-from,
|
||||
.slide-leave-to {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user