diff --git a/begushiybashkir/bbvue/src/components/AvatarUpload.vue b/begushiybashkir/bbvue/src/components/AvatarUpload.vue
index 36a8195..bbf0a02 100644
--- a/begushiybashkir/bbvue/src/components/AvatarUpload.vue
+++ b/begushiybashkir/bbvue/src/components/AvatarUpload.vue
@@ -1,246 +1,117 @@
-
-
-
-
-
![Avatar]()
-
- 📷
- Добавить фото
-
-
- ✏️
-
-
-
-
-
-
- Загрузка...
-
-
-
- {{ error }}
-
-
-
-
-
-
-
-
+
+ },
+ setup() {
+ const authStore = useAuthStore()
+ return { authStore }
+ },
+ data() {
+ return {
+ previewUrl: null,
+ uploading: false,
+ error: ''
+ }
+ },
+ watch: {
+ user: {
+ immediate: true,
+ handler(newUser) {
+ console.log('User data in AvatarUpload:', newUser)
+ if (newUser?.avatar) {
+ console.log('Avatar path:', newUser.avatar)
+ const fullUrl = this.getFullAvatarUrl(newUser.avatar)
+ console.log('Full avatar URL:', fullUrl)
+ this.previewUrl = fullUrl
+ } else {
+ console.log('No avatar found')
+ this.previewUrl = null
+ }
+ }
+ }
+ },
+ methods: {
+ getFullAvatarUrl(avatarPath) {
+ if (!avatarPath) return null
+
+ console.log('Building URL for avatar path:', avatarPath)
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/begushiybashkir/bbvue/src/views/Profile.vue b/begushiybashkir/bbvue/src/views/Profile.vue
index aee541c..cd457ca 100644
--- a/begushiybashkir/bbvue/src/views/Profile.vue
+++ b/begushiybashkir/bbvue/src/views/Profile.vue
@@ -171,6 +171,11 @@ export default {
}
},
methods: {
+ async onAvatarUpdated() {
+ // Принудительно обновляем профиль
+ await this.authStore.fetchProfile()
+ console.log('Avatar updated, user data:', this.authStore.user)
+ },
getImageUrl(path) {
const baseUrl = import.meta.env.BASE_URL
return `${baseUrl}images/${path}`
diff --git a/begushiybashkir/bbvue/src/views/ProfileEdit.vue b/begushiybashkir/bbvue/src/views/ProfileEdit.vue
index 17e4aff..1f88818 100644
--- a/begushiybashkir/bbvue/src/views/ProfileEdit.vue
+++ b/begushiybashkir/bbvue/src/views/ProfileEdit.vue
@@ -4,7 +4,7 @@
Загрузка...
@@ -137,6 +137,11 @@ export default {
}
},
methods: {
+ async onAvatarUpdated() {
+ // Обновляем данные пользователя после загрузки аватара
+ await this.authStore.fetchProfile()
+ this.initializeForm()
+ },
initializeForm() {
if (this.user) {
this.formData = {