feat: avatar upload for profile/chats, fix session persistence on refresh
- Profile modal: upload/remove user avatar, edit name/bio/phone, change password - Chat info panel: upload/remove chat photo (owner/admin only) - Avatar component: render photo when available, fallback to initials - Session fix: initialize Zustand store from localStorage to prevent redirect on refresh - Backend: avatar upload endpoints for users and chats, migration adds avatar columns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,8 +26,15 @@ interface AppStore {
|
||||
logout: () => void;
|
||||
}
|
||||
|
||||
function loadUser(): User | null {
|
||||
try {
|
||||
const s = localStorage.getItem('jc_user');
|
||||
return s ? JSON.parse(s) : null;
|
||||
} catch { return null; }
|
||||
}
|
||||
|
||||
export const useStore = create<AppStore>((set, get) => ({
|
||||
user: null,
|
||||
user: loadUser(),
|
||||
chats: [],
|
||||
activeChat: null,
|
||||
messages: {},
|
||||
|
||||
Reference in New Issue
Block a user