feat(improvement): add pagination to endpoints and pages + sync navbar when data changes
This commit is contained in:
@@ -114,6 +114,8 @@ export default function Profile() {
|
||||
const updatedUser = await updateUserProfile(payload)
|
||||
setUser(prev => prev ? { ...prev, ...updatedUser } : updatedUser)
|
||||
setIsEditing(false)
|
||||
|
||||
window.dispatchEvent(new CustomEvent('profile_updated', { detail: updatedUser }));
|
||||
toast.success(t.profile.toasts.successEdit)
|
||||
} catch (error) {
|
||||
toast.error(t.profile.toasts.error)
|
||||
@@ -131,6 +133,8 @@ export default function Profile() {
|
||||
setUser(prev => prev ? { ...prev, profile_picture: response.profile_picture } : response)
|
||||
setIsPicModalOpen(false)
|
||||
setSelectedFile(null)
|
||||
|
||||
window.dispatchEvent(new CustomEvent('profile_updated', { detail: { profile_picture: response.profile_picture || null } }));
|
||||
toast.success(t.profile.toasts.successImage)
|
||||
} catch (error) {
|
||||
toast.error(t.profile.toasts.error)
|
||||
@@ -146,6 +150,7 @@ export default function Profile() {
|
||||
const response = await removeProfilePicture()
|
||||
setUser(prev => prev ? { ...prev, profile_picture: response.profile_picture || null } : response)
|
||||
setIsPicModalOpen(false)
|
||||
window.dispatchEvent(new CustomEvent('profile_updated', { detail: { profile_picture: response.profile_picture || null } }));
|
||||
toast.success(t.profile.toasts.successRemoveImage)
|
||||
} catch (error) {
|
||||
toast.error(t.profile.toasts.error)
|
||||
|
||||
Reference in New Issue
Block a user