Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to get back to login page when offline #294

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading