feat: Add core e-learning pages for authentication, course discovery, learning, and user dashboard.
This commit is contained in:
parent
c4f68eb927
commit
9629f79c52
5 changed files with 13 additions and 65 deletions
|
|
@ -10,7 +10,8 @@ useHead({
|
|||
|
||||
const { currentUser, updateUserProfile, changePassword, uploadAvatar } = useAuth()
|
||||
const { t } = useI18n()
|
||||
const { errors, validate, clearFieldError } = useFormValidation()
|
||||
// const { errors, validate, clearFieldError } = useFormValidation() // Unused
|
||||
|
||||
|
||||
const isEditing = ref(false)
|
||||
const isProfileSaving = ref(false)
|
||||
|
|
@ -106,41 +107,7 @@ const handleFileUpload = async (event: Event) => {
|
|||
}
|
||||
}
|
||||
|
||||
const handleDeleteAvatar = async () => {
|
||||
// 1. Clear local preview
|
||||
userData.value.photoURL = ''
|
||||
|
||||
// 2. Update Auth State
|
||||
if (currentUser.value?.role) {
|
||||
// Direct manipulation since useAuth is shared state
|
||||
if (currentUser.value.photoURL) {
|
||||
// We can't set currentUser directly as it is computed.
|
||||
// We must access the underlying user state from useAuth?
|
||||
// But we only destructured what we needed.
|
||||
}
|
||||
}
|
||||
|
||||
// Access the user raw ref from useAuth would be better but we didn't destructure it.
|
||||
// However, we can use a workaround: call updateUserProfile with empty avatar if supported OR just assume local state.
|
||||
// The user requirement is: "If delete is clicked ... display q-avatar__content".
|
||||
// Since we don't have a confirmed DELETE API, we will just update the visual state.
|
||||
// To make it persist somewhat (until refresh), we update the cookie via a helper if possible,
|
||||
// BUT since we don't have access to `user` ref here (only currentUser computed),
|
||||
// let's grab `user` from useAuth() again or add it to destructure.
|
||||
|
||||
// Actually, I'll allow this component to just visual clear for now,
|
||||
// until we confirm API. But wait, `uploadAvatar` updates the global user state.
|
||||
// We should probably export `user` from useAuth or Add a `clearAvatar` method to useAuth.
|
||||
// For now, let's keep it simple in the component:
|
||||
|
||||
// TODO: Call API to delete avatar if endpoint exists.
|
||||
// For now, visual clear.
|
||||
|
||||
const { user } = useAuth() // Re-access to get the raw user ref
|
||||
if (user.value && user.value.profile) {
|
||||
user.value.profile.avatar_url = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleUpdateProfile = async () => {
|
||||
isProfileSaving.value = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue