Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46eaefb
commit 9de31d3
Showing
5 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<div> | ||
<h2>Login form</h2> | ||
<form @submit.prevent="onSubmit" id="form"> | ||
<input v-model="username" required type="text" placeholder="Username" /> | ||
<input | ||
v-model="password" | ||
required | ||
type="password" | ||
placeholder="Password" | ||
/> | ||
<input type="submit" value="Login" /> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "AppLogin", | ||
data() { | ||
return { | ||
username: "", | ||
password: "" | ||
}; | ||
}, | ||
methods: { | ||
async onSubmit() { | ||
try { | ||
await this.$store.dispatch("doLogin", this.username); | ||
this.$router.push({ name: "Dashboard" }); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
div { | ||
padding: 7rem 0.5rem; | ||
width: 30vw; | ||
min-width: 500px; | ||
margin: 0 auto; | ||
} | ||
form { | ||
background-color: gray; | ||
padding: 1rem; | ||
} | ||
form * { | ||
width: 100%; | ||
margin: 0.3rem 0; | ||
padding: 0.2rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div> | ||
<h1>User Dashboard</h1> | ||
<a href="#" @click="onLogout">Logout</a> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "UserDashboard", | ||
methods: { | ||
onLogout() { | ||
this.$store.dispatch("doLogout"); | ||
this.$router.push("/"); | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
div { | ||
padding: 7rem 0.5rem; | ||
text-align: center; | ||
} | ||
</style> |