Skip to content

Commit

Permalink
🚸 Move sign out to setting
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
nwingt committed Aug 17, 2024
1 parent 880f03f commit e4d57ae
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
34 changes: 8 additions & 26 deletions components/AppMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,24 @@
<div class="flex flex-col gap-4 grow w-full p-5">
<UVerticalNavigation class="grow" :links="menuLinks" />

<UButton variant="outline" size="xl" block @click="logout">
Logout
</UButton>
<UButton
label="Settings"
icon="i-heroicons-cog-8-tooth"
variant="soft"
size="sm"
to="/settings"
block
/>
</div>
</div>
</template>

<script setup lang="ts">
import { useDisconnect } from "@wagmi/vue";
import { useUserStore } from '../stores/user';
const userStore = useUserStore()
const { disconnect } = useDisconnect();
const menuLinks = [
{
label: "Books",
icon: "i-heroicons-book-open",
to: "/",
},
{
label: "Settings",
icon: "i-heroicons-cog-8-tooth",
to: "/settings",
},
];
async function logout() {
try {
await userStore.logout();
} catch (error) {
console.error(error);
} finally {
disconnect();
}
}
</script>
19 changes: 19 additions & 0 deletions pages/settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@
</UInput>

</UFormGroup>

<UButton variant="outline" block size="xl" @click="signOut">
Sign out
</UButton>
</AppPageBody>
</div>
</template>

<script setup lang="ts">
import { useDisconnect } from "@wagmi/vue";
import { useUserStore } from '../stores/user';
const { disconnect } = useDisconnect();
const userStore = useUserStore();
const toast = useToast();
Expand All @@ -40,4 +49,14 @@ function copyAddress() {
title: "Copied address to clipboard"
});
}
async function signOut() {
try {
await userStore.logout();
} catch (error) {
console.error(error);
} finally {
disconnect();
}
}
</script>

0 comments on commit e4d57ae

Please sign in to comment.