modified: serv_nginx/bbvue/src/stores/auth.js

modified:   serv_nginx/bbvue/src/views/Profile.vue
	modified:   serv_nginx/bbvue/src/views/ProfileEdit.vue
save debug commit only
This commit is contained in:
2025-10-19 21:43:09 +05:00
parent 17b936f566
commit e3f77f3a84
3 changed files with 38 additions and 4 deletions
+2
View File
@@ -82,6 +82,8 @@ export const useAuthStore = defineStore('auth', () => {
return withLoading({ loading, error }, async () => {
const response = await apiClient.get('/user/profile')
setUser(response.data)
console.log('DEBUG - Profile API response:', response.data);
return { success: true, data: response.data }
})
}
+20 -1
View File
@@ -247,10 +247,29 @@ export default {
return baseUrl + filename;
},
joinDate() {
if (!this.user?.createdAt) return 'января 2024';
// Добавим отладку для всего объекта user
console.log('DEBUG - user object:', this.user);
console.log('DEBUG - user keys:', this.user ? Object.keys(this.user) : 'no user');
if (!this.user?.createdAt) {
console.log('DEBUG - createdAt is missing or falsy');
return 'Неизвестно';
}
if (!this.user?.createdAt) return 'Неизвестно';
console.log('DEBUG - createdAt:', this.user.createdAt, 'Type:', typeof this.user.createdAt);
// Пробуем просто создать дату
const date = new Date(this.user.createdAt);
console.log('DEBUG - parsed date:', date);
if (isNaN(date.getTime())) {
return 'Неизвестно';
}
const month = date.toLocaleString('ru-RU', { month: 'long' });
const year = date.getFullYear();
return `${month} ${year}`;
},
experienceLabel() {
+16 -3
View File
@@ -24,6 +24,12 @@
</div>
</div>
<div class="form-group">
<label for="phone">Телефон</label>
<input id="phone" v-model="formData.phone" type="tel" class="form-input" placeholder="+7 (XXX) XXX-XX-XX"
:disabled="loading">
</div>
<div class="form-group">
<label for="email">Email *</label>
<input id="email" v-model="formData.email" type="email" class="form-input" placeholder="example@mail.ru"
@@ -174,15 +180,22 @@ export default {
this.success = false
try {
// Используем метод updateProfile из authStore
const result = await this.authStore.updateProfile({
// Выделяем данные в отдельный объект
const profileData = {
firstName: this.formData.firstName,
lastName: this.formData.lastName,
phone: this.formData.phone,
experience: this.formData.experience,
goals: this.formData.goals,
newsletter: this.formData.newsletter
})
};
// debug only
console.log("dubug profile Data = " + profileData)
// Используем метод updateProfile из authStore
// Отправляем на обновление профиль
const result = await this.authStore.updateProfile(profileData);
if (result.success) {
this.originalData = { ...this.formData }