Skip to content

Commit c0184ba

Browse files
Create button in Navigation component for logging out
1 parent 1964f51 commit c0184ba

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: resources/assets/js/prototype/components/Navigation.vue

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
<script setup>
2-
import { ArrowRightLeft, Home } from 'lucide-vue';
2+
import { ArrowRightLeft, Home, LogOut } from 'lucide-vue';
3+
import { getCurrentInstance } from 'vue';
4+
5+
const router = getCurrentInstance().proxy.$router;
6+
7+
const logOut = () => {
8+
localStorage.removeItem('api_key');
9+
10+
router.push('login');
11+
};
312
</script>
413

514
<template>
615
<div class="flex items-center h-16 bg-white border-b border-gray-200">
7-
<div class="mx-auto flex-1 max-w-5xl">
16+
<div class="mx-auto flex-1 flex items-center justify-between max-w-5xl">
817
<div class="flex space-x-4">
918
<router-link class="flex items-center py-1 px-3 text-gray-500 hover:text-black" :to="{ name: 'dashboard' }">
1019
<Home :size="16" />
@@ -15,6 +24,11 @@ import { ArrowRightLeft, Home } from 'lucide-vue';
1524
<span class="ml-2 text-sm">Transactions</span>
1625
</router-link>
1726
</div>
27+
<div>
28+
<button class="flex py-1 px-3 text-gray-500 hover:text-black" @click="logOut()">
29+
<LogOut :size="16" />
30+
</button>
31+
</div>
1832
</div>
1933
</div>
2034
</template>

0 commit comments

Comments
 (0)