1
This commit is contained in:
38
Yes.Blog/wwwroot/admin/js/user/password.js
Normal file
38
Yes.Blog/wwwroot/admin/js/user/password.js
Normal file
@@ -0,0 +1,38 @@
|
||||
document.addEventListener('alpine:init', function () {
|
||||
Alpine.data('data', function () {
|
||||
|
||||
const id = getUrlParameter("id");
|
||||
return {
|
||||
user: {
|
||||
},
|
||||
isSubmitting: false,
|
||||
loadUser() {
|
||||
axios.get('users/profile')
|
||||
.then(data => {
|
||||
this.user = data;
|
||||
});
|
||||
return this;
|
||||
},
|
||||
editUser() {
|
||||
if (this.isSubmitting) {
|
||||
return;
|
||||
}
|
||||
this.isSubmitting = true;
|
||||
axios.put('users/password', this.user)
|
||||
.then(data => {
|
||||
location.href = "/admin/user/profile";
|
||||
})
|
||||
.finally(() => {
|
||||
this.isSubmitting = false;
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this.loadUser();
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
document.title = "修改密码 - " + window.config.name + "";
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user