Skip to content

Commit

Permalink
Moved signout button & functionality to header
Browse files Browse the repository at this point in the history
  • Loading branch information
BT-Creator committed Jul 16, 2024
1 parent 337928e commit 0b8c479
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
11 changes: 9 additions & 2 deletions loama/src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
<nav>
<slot></slot>
</nav>
<img :src="pfpSrc" alt="User profile picture" @click="showContextMenu()"/>
<img :src="pfpSrc" alt="User profile picture" @click="showContextMenu"/>
</header>
<aside :class="{visible: isContextMenuOpen}">
<div>
<strong>Name of Pod</strong>
<p>https://css12.onto-deside.ilabt.imec.be/osoc1/</p>
</div>
<label for="pod">Selected Pod</label>
<select>
<option selected>https://css12.onto-deside.ilabt.imec.be/osoc1/</option>
<option>https://css12.onto-deside.ilabt.imec.be/osoc1/</option>
</select>
<button @click.prevent="logout">Sign out</button>
</aside>
</template>

Expand Down Expand Up @@ -89,6 +90,7 @@
import { ref } from 'vue';
import Loama from '../assets/loama.svg'
import { store } from '@/store';
import router from '@/router';
const props = defineProps<{
pfpSrc: string,
Expand All @@ -97,6 +99,11 @@ const props = defineProps<{
const isContextMenuOpen = ref(false)
console.log(store.usedPod)
const session = store.session;
async function logout() {
session.logout();
router.push('/');
}
function showContextMenu() {
isContextMenuOpen.value = !isContextMenuOpen.value
}
Expand Down
10 changes: 0 additions & 10 deletions loama/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<HeaderTab href="/home" active>Files</HeaderTab>
</Header>
<main>
<button @click="logout">Logout</button>

<hr />
<Suspense>
<PodList />
Expand All @@ -17,15 +15,7 @@
</template>

<script setup lang="ts">
import { Fragment } from "vue/jsx-runtime";
import HeaderTab from "../components/HeaderTab.vue";
import Header from '../components/Header.vue'
import PodList from '../components/PodList.vue'
import router from "@/router";
import { store } from "@/store";
const session = store.session;
const logout = async () => { session.logout(); router.push('/'); }
</script>

0 comments on commit 0b8c479

Please sign in to comment.