фикс
This commit is contained in:
parent
9068c4eac3
commit
4ef69dfe18
@ -153,14 +153,14 @@
|
||||
|
||||
<script>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useAuth } from '@/auth'
|
||||
import api from '@/services/api'
|
||||
import citiesData from '@/assets/russian-cities.json'
|
||||
|
||||
export default {
|
||||
name: 'PreferencesView',
|
||||
setup() {
|
||||
const authStore = useAuthStore()
|
||||
const { user } = useAuth()
|
||||
const loading = ref(false)
|
||||
const message = ref('')
|
||||
const messageType = ref('') // 'success' или 'error'
|
||||
@ -184,7 +184,6 @@ export default {
|
||||
const filteredCities = ref([])
|
||||
|
||||
// Вычисляемые свойства
|
||||
const user = computed(() => authStore.user)
|
||||
const currentUserAge = computed(() => {
|
||||
if (!user.value?.dateOfBirth) return null
|
||||
const birthDate = new Date(user.value.dateOfBirth)
|
||||
@ -275,8 +274,10 @@ export default {
|
||||
preferences: preferences.value
|
||||
})
|
||||
|
||||
// Обновляем данные в store
|
||||
authStore.updateUser(response.data)
|
||||
// Обновляем данные пользователя в локальном состоянии
|
||||
if (response.data && user.value) {
|
||||
user.value = { ...user.value, ...response.data }
|
||||
}
|
||||
|
||||
showMessage('Предпочтения успешно сохранены!', 'success')
|
||||
} catch (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user