feat(improvement): add pagination to endpoints and pages + sync navbar when data changes

This commit is contained in:
2026-03-13 10:30:27 +08:00
parent a9ebbf6a4a
commit 56404792c6
14 changed files with 543 additions and 210 deletions

View File

@@ -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)