Skip to content

Commit 7a4acac

Browse files
author
Garrett Downs
committed
feat: add sign out button to settings view
1 parent 6aa57a1 commit 7a4acac

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

src/routes/AppSettings.svelte

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import Button from 'onyx-ui/components/buttons/Button.svelte';
3+
import ConfirmButton from 'onyx-ui/components/buttons/ConfirmButton.svelte';
34
import Card from 'onyx-ui/components/card/Card.svelte';
45
import CardContent from 'onyx-ui/components/card/CardContent.svelte';
56
import CardHeader from 'onyx-ui/components/card/CardHeader.svelte';
@@ -9,12 +10,13 @@
910
import ListHeader from 'onyx-ui/components/list/ListHeader.svelte';
1011
import View from 'onyx-ui/components/view/View.svelte';
1112
import ViewContent from 'onyx-ui/components/view/ViewContent.svelte';
12-
import { Animations, DataStatus, TextSize, TextWeight } from 'onyx-ui/enums';
13+
import { Animations, Color, DataStatus, TextSize, TextWeight } from 'onyx-ui/enums';
1314
import { Onyx } from 'onyx-ui/services';
1415
import { registerView, updateView, view } from 'onyx-ui/stores/view';
1516
import { onMount } from 'svelte';
1617
import MdCheck from 'svelte-icons/md/MdCheck.svelte';
17-
import { replace } from 'svelte-spa-router';
18+
import { push, replace } from 'svelte-spa-router';
19+
import { Auth } from '../lib/auth';
1820
import { Cache } from '../lib/cache';
1921
import type { Settings } from '../models';
2022
import { settings } from '../stores/settings';
@@ -307,6 +309,21 @@
307309
},
308310
}}
309311
/>
312+
<ConfirmButton
313+
title="Sign Out"
314+
color={Color.Accent}
315+
confirmText="Yes, sign out"
316+
onConfirm={() => {
317+
new Auth().clearSession();
318+
push('/signin');
319+
Onyx.toaster.show({
320+
title: 'Successfully signed out',
321+
icon: MdCheck,
322+
type: 'info',
323+
});
324+
}}
325+
onCancel={() => {}}
326+
/>
310327
</CardContent>
311328
</Card>
312329
{/if}

0 commit comments

Comments
 (0)