Skip to content

Commit

Permalink
Add button to get back to login page when offline (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinsSpencer authored Jan 19, 2025
1 parent 4aae264 commit 31e7516
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/renderer/components/navbar/Exit.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
<template>
<Modal ref="modal" title="Exit">
<div class="flex-row gap-md">
<Button @click="logout">Logout</Button>
<Button @click="login" v-if="!me.isOnline && !onLoginPage">Login</Button>
<Button @click="logout" v-if="me.isOnline && !onLoginPage">Logout</Button>
<Button @click="quitToDesktop">Quit to Desktop</Button>
</div>
</Modal>
</template>

<script lang="ts" setup>
import { Ref, ref } from "vue";
import { computed, Ref, ref } from "vue";
import { useRouter } from "vue-router";
import Modal from "@renderer/components/common/Modal.vue";
import Button from "@renderer/components/controls/Button.vue";
import { auth } from "@renderer/store/me.store";
import { settingsStore } from "@renderer/store/settings.store";
import { me } from "@renderer/store/me.store";
const router = useRouter();
const modal: Ref<InstanceType<typeof Modal> | null> = ref(null);
const currentRoute = router.currentRoute;
const onLoginPage = computed(() => currentRoute.value.path === "/login");
async function login() {
await router.push("/login");
modal.value?.close();
}
async function logout() {
auth.logout();
Expand Down

0 comments on commit 31e7516

Please sign in to comment.