mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 16:07:33 +08:00
show current profile in user profile page
This commit is contained in:
@@ -67,6 +67,8 @@ export default {
|
||||
inputIsNotChangedProblemMessage() {
|
||||
if (!this.password && !this.confirmPassword && !this.email && !this.nickname) {
|
||||
return 'Nothing has been modified';
|
||||
} else if (!this.password && !this.confirmPassword && this.email === this.oldEmail && this.nickname === this.oldNickname) {
|
||||
return 'Nothing has been modified';
|
||||
} else if (!this.password && this.confirmPassword) {
|
||||
return 'Password cannot be empty';
|
||||
} else if (this.password && !this.confirmPassword) {
|
||||
@@ -83,6 +85,43 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const self = this;
|
||||
const app = self.$f7;
|
||||
const router = self.$f7router;
|
||||
|
||||
app.preloader.show();
|
||||
|
||||
self.$services.getProfile().then(response => {
|
||||
app.preloader.hide();
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
self.$alert('Unable to get user profile', () => {
|
||||
router.back();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
self.oldEmail = data.result.email;
|
||||
self.oldNickname = data.result.nickname;
|
||||
|
||||
self.email = self.oldEmail
|
||||
self.nickname = self.oldNickname;
|
||||
}).catch(error => {
|
||||
app.preloader.hide();
|
||||
|
||||
if (error.response && error.response.data && error.response.data.errorMessage) {
|
||||
self.$alert({ error: error.response.data }, () => {
|
||||
router.back();
|
||||
});
|
||||
} else {
|
||||
self.$alert('Unable to get user profile', () => {
|
||||
router.back();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
const self = this;
|
||||
@@ -127,7 +166,7 @@ export default {
|
||||
}
|
||||
|
||||
self.$toast('Your profile has been successfully updated');
|
||||
router.back();
|
||||
router.back('/settings', { force: true });
|
||||
}).catch(error => {
|
||||
hasResponse = true;
|
||||
app.preloader.hide();
|
||||
|
||||
Reference in New Issue
Block a user