added feature for OTP-SMS Koperasi

This commit is contained in:
Hafifie PKB
2024-03-25 21:40:03 +08:00
parent 25accab176
commit 9c9fe7719e
13 changed files with 475 additions and 24 deletions
@@ -43,29 +43,19 @@ export default{
},
methods: {
login: function () {
if (this.loading) return;
let vm = this;
this.startLoading();
login: function(){
axios.post(config.API+'voter/login', $('#login_form').serialize())
.then(response => {
vm.stopLoading();
if (this.util.showResult(response, 'success')) {
localStorage['Access Token'] = `Bearer ${response.data.token}`;
this.util.setAuthorization();
vm.$router.push({name: 'Voter Home'});
}
})
.catch(error => {
vm.stopLoading();
this.util.showResult(error, 'error');
})
.then(response => {
this.stopLoading();
if (this.util.showResult(response, 'success')) {
this.$router.push({ name: 'Voter Verify',params: {'nokp' : response.data.nokp,'notel' : response.data.notel} })
}
})
.catch(error => {
vm.stopLoading();
this.util.showResult(error, 'error');
})
},
startLoading: function () {
this.util.notify('Logging in', 'loading');
this.loading = true;