log优化
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { createLogger } from './logger.js';
|
||||
|
||||
const logger = createLogger('profile');
|
||||
const DEFAULT_AVATAR = '/images/p1.png';
|
||||
const MAX_AVATAR_SIZE = 2 * 1024 * 1024;
|
||||
const USER_ID_PREFIX = 'user_';
|
||||
@@ -100,7 +103,7 @@ export function createProfileSettingsController({ store, notify }) {
|
||||
updateUserName(settings.name || '\u6211');
|
||||
setAvatarPreview(settings.avatar || DEFAULT_AVATAR);
|
||||
} catch (error) {
|
||||
console.error('Error loading user settings:', error);
|
||||
logger.error('Error loading user settings:', error);
|
||||
setAvatarPreview(DEFAULT_AVATAR);
|
||||
}
|
||||
}
|
||||
@@ -152,7 +155,7 @@ export function createProfileSettingsController({ store, notify }) {
|
||||
saveSettings();
|
||||
notify('\u5934\u50cf\u4e0a\u4f20\u6210\u529f', 'success');
|
||||
} catch (error) {
|
||||
console.error('Error uploading avatar:', error);
|
||||
logger.error('Error uploading avatar:', error);
|
||||
setAvatarPreview(DEFAULT_AVATAR);
|
||||
notify('\u5934\u50cf\u4e0a\u4f20\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5', 'error');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user