feat: add login in frontend

* extract icon library from main.js
* extract router from main.js
* failure with error in passport
* add example to swagger
This commit is contained in:
Lin, Hung-Shin committed 2023-09-13 14:02:28 +08:00
1 parent b55b7aa1ec
commit 49417c405a
11 files changed
+206 -61

No files matched your search

+17 -1
View File
@@ -1,4 +1,14 @@
<script setup></script>
<script setup>
import { useRouter } from 'vue-router'
import { isAuthenticated, logout } from '../utils/auth'
const router = useRouter()
const handleLogout = () => {
logout()
router.push({ name: 'auth' })
}
</script>
<template>
<div class="h-full flex items-center justify-center mx-3">
@@ -46,6 +56,12 @@
class="text-text-primary h-5 w-5"
/>
</button>
<button v-if="isAuthenticated" @click="handleLogout">
<font-awesome-icon
:icon="['fas', 'arrow-right-from-bracket']"
class="text-text-primary h-5 w-5"
/>
</button>
</div>
</div>
</template>