Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var swal = this.$swal;
- swal({
- title: "Sign In ..",
- allowOutsideClick: false,
- showConfirmButton: false,
- width: 400,
- onOpen: () => {
- window.localStorage.removeItem('user');
- swal.showLoading();
- axios
- .post(
- baseUrl + "/admin/login",
- {
- username: this.username,
- password: this.password
- },
- {
- headers: {
- "Content-Type": "application/json"
- }
- }
- )
- .then(response => {
- swal.close();
- localStorage.setItem(
- "user",
- JSON.stringify(response.data.results[0])
- );
- console.log(response.data.results[0]);
- window.location.reload();
- this.$router.push("/buku-tamu");
- })
- .catch(a => {
- swal.close();
- this.login = false;
- this.$swal({
- width: 400,
- type: "error",
- title: "Oops...",
- text: a.response.data.message,
- footer: "<a href>Forgot Password?</a>"
- });
- (this.username = null),
- (this.password = null),
- this.error.push(e);
- console.log(e);
- });
- }
- }).then(result => {});
- })
- .catch(() => {});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement