Skip to content

Commit

Permalink
feat: login with nuxt auth
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Feb 22, 2021
1 parent 87bc3f8 commit 5f26d6b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions components/pages/premium/Login.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="p-4 material-container text-default-text">
<form @submit.prevent="checkForm()">
<form @submit.prevent="userLogin">
<label
class="block mb-2 text-lg font-medium leading-tight"
for="license-key"
Expand All @@ -11,12 +11,12 @@
<div class="flex items-center w-full mt-1">
<input
id="license-key"
v-model="login.password"
class="flex-grow block w-10/12 p-2 text-sm font-light border rounded-md shadow-sm outline-none appearance-none bg-background border-border"
placeholder="XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX"
type="text"
name="license-key"
required
@input="setLicenseKey($event.target.value)"
/>

<!-- Action -->
Expand All @@ -40,12 +40,22 @@ export default {
ChevronRightIcon,
},
data() {
return {
login: {
password: '',
},
}
},
methods: {
...mapActions('premium', ['authenticate']),
...mapMutations('premium', ['setLicenseKey']),
checkForm(event) {
this.authenticate()
async userLogin() {
await this.setLicenseKey(this.login.password)
await this.authenticate()
},
},
}
Expand Down

0 comments on commit 5f26d6b

Please sign in to comment.