@@ -24,7 +24,8 @@ export const BasicInfoSettings = (): JSX.Element => {
sync();
toastSuccess(t('toaster.update_successed', { target: t('Basic Info'), ns: 'commons' }));
}
- catch (err) {
+ catch (errs) {
+ const err = errs[0];
const message = err.message;
const code = err.code;
@@ -149,7 +149,7 @@ module.exports = function(crowi) {
const userData = await User.findOne({ email: this.email });
- if (userData != null && this._id !== userData._id) {
+ if (userData != null && this.username !== userData.username) {
return false;
return true;
@@ -70,15 +70,7 @@ export const usePersonalSettings = (config?: SWRConfiguration): SWRResponse<IUse
catch (errs) {
logger.error(errs);
-
- const err = errs[0];
- const code = err.code;
- if (code === 'email-is-already-in-use') {
- throw new ErrorV3('The email is already in use', code);
- }
- throw new ErrorV3('Failed to update personal data', 'failed-to-update-personal-data');
+ throw errs;
};