mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
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:
1 parent
b55b7aa1ec
commit
49417c405a
11 files changed
+206
-61
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user