-
Notifications
You must be signed in to change notification settings - Fork 1
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
e7dc350
commit 6a0e00e
Showing
4 changed files
with
50 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
<script setup> | ||
import {reactive} from "vue"; | ||
import useAuth from "../auth/useAuth.js"; | ||
import router from "../router/index.js"; | ||
const form = reactive({ | ||
email: 'polashmahmud@gmail.com', | ||
password: 'password' | ||
email: '', | ||
password: '' | ||
}) | ||
const {login, getUser: user, getAuthenticated: authenticated} = useAuth() | ||
const {login, getUser: user, getAuthenticated: authenticated, errors} = useAuth() | ||
const handleLogin = () => { | ||
login(form).then(() => { | ||
router.push({ name: 'admin.post'} ) | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
{{ user }} {{ authenticated }} | ||
<form v-on:submit.prevent="login(form)"> | ||
<button type="submit">Login</button> | ||
<h1 class="text-xl font-medium text-center mb-6">Login</h1> | ||
<form class="max-w-lg mx-auto border rounded-lg p-6" v-on:submit.prevent="handleLogin"> | ||
<div class="mb-3"> | ||
<label for="email" class="leading-7 text-gray-600 text-sm">Email</label> | ||
<input v-model="form.email" type="email" name="email" id="email" class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out"> | ||
<div v-if="errors.email"> | ||
<p class="text-xs text-red-500">{{ errors.email[0] }}</p> | ||
</div> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="password" class="leading-7 text-gray-600 text-sm">Password</label> | ||
<input v-model="form.password" type="password" name="password" id="password" class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out"> | ||
<div v-if="errors.password"> | ||
<p class="text-xs text-red-500">{{ errors.password[0] }}</p> | ||
</div> | ||
</div> | ||
<button type="submit" class="text-white w-full bg-indigo-500 border-0 py-2 px-6 focus:outline-none hover:bg-indigo-600 rounded text-lg">Login</button> | ||
</form> | ||
</template> |
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,5 @@ | ||
<script setup></script> | ||
|
||
<template> | ||
Admin Posts | ||
</template> |
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