fix(notification+vlog upload)
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 46s
Deploy to Production / build-and-deploy (push) Successful in 1m47s

This commit is contained in:
EvanChal
2026-01-27 02:39:51 +01:00
parent 658b7a9dda
commit f33dfd5ab7
20 changed files with 499 additions and 262 deletions

View File

@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import axios from '@/utils/axios'
import { uploadFormData } from '@/utils/axios'
import router from '@/router'
import { useToast } from 'vue-toastification'
@@ -112,15 +113,13 @@ export const useAuthStore = defineStore('auth', () => {
const formData = new FormData()
formData.append('file', file)
const response = await axios.post('/api/users/me/avatar', formData)
user.value = response.data
const data = await uploadFormData('/api/users/me/avatar', formData)
user.value = data
toast.success('Avatar mis à jour')
return { success: true, data: response.data }
return { success: true, data }
} catch (error) {
console.error('Error uploading avatar:', error)
toast.error('Erreur lors de l\'upload de l\'avatar')
return { success: false, error: error.response?.data?.detail || 'Erreur inconnue' }
return { success: false, error: error.message || 'Erreur inconnue' }
}
}