Skip to content

Commit

Permalink
feat: add sign out
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Mar 15, 2023
1 parent 2386c50 commit 1ad6545
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 22 deletions.
21 changes: 12 additions & 9 deletions components/app/AppAccount.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<script lang="ts" setup>
const { signIn, status, data } = useSession();
const { signIn, status, data, signOut } = useSession();
</script>

<template>
<div>
<el-button v-if="status === 'unauthenticated'" text @click="() => signIn()">
<el-icon class="i-carbon:user"></el-icon>
<div class="i-carbon:user-avatar-filled"></div>
</el-button>
<el-avatar
v-else-if="status === 'authenticated'"
:size="32"
:src="data?.user?.image ?? ''"
>
{{ data?.user?.name }}
</el-avatar>
<el-dropdown v-else-if="status === 'authenticated'">
<el-avatar :size="32" :src="data?.user?.image ?? ''">
{{ data?.user?.name }}
</el-avatar>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="() => signOut()">Sign Out</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
3 changes: 3 additions & 0 deletions components/tool/ToolLocalAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { ToolItem } from "~~/types";
const localePath = useLocalePath();
const { status } = useSession();
const { remove, create: localCreate } = useLocalTools();
const { create } = await useAsyncRemoteTools({
immediate: false,
Expand Down Expand Up @@ -42,6 +44,7 @@ const handleUpload = async () => {
<el-icon class="i-carbon:trash-can"></el-icon>
</el-button>
<el-button
v-if="status === 'authenticated'"
:loading="loading"
class="ml-0!"
@click="handleUpload"
Expand Down
13 changes: 0 additions & 13 deletions plugins/storage.client.ts

This file was deleted.

0 comments on commit 1ad6545

Please sign in to comment.