Skip to content

Commit

Permalink
Added a Sign-out button
Browse files Browse the repository at this point in the history
  • Loading branch information
WongSaang committed Mar 19, 2023
1 parent 3866591 commit 727826f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"copy": "Copy",
"copied": "Copied",
"delete": "Delete",
"signOut": "Sign out",
"welcomeScreen": {
"introduction1": "is an unofficial client for ChatGPT, but uses the official OpenAI API.",
"introduction2": "You will need an OpenAI API Key before you can use this client.",
Expand Down
1 change: 1 addition & 0 deletions lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"copy": "复制",
"copied": "已复制",
"delete": "删除",
"signOut": "退出登录",
"welcomeScreen": {
"introduction1": "是一个非官方的ChatGPT客户端,但使用OpenAI的官方API",
"introduction2": "在使用本客户端之前,您需要一个OpenAI API密钥。",
Expand Down
37 changes: 18 additions & 19 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import {useDisplay} from "vuetify";
const { $i18n } = useNuxtApp()
const { $i18n, $auth } = useNuxtApp()
const runtimeConfig = useRuntimeConfig()
const colorMode = useColorMode()
const drawer = ref(null)
Expand Down Expand Up @@ -88,6 +88,15 @@ const drawerPermanent = computed(() => {
return mdAndUp.value
})
const signOut = async () => {
const { data, error } = await useFetch('/api/account/logout/', {
method: 'POST'
})
if (!error.value) {
await $auth.logout()
}
}
onNuxtReady(async () => {
loadConversations()
})
Expand Down Expand Up @@ -261,6 +270,14 @@ onNuxtReady(async () => {
:title="$t('feedback')"
@click="feedback"
></v-list-item>

<v-list-item
rounded="xl"
prepend-icon="logout"
:title="$t('signOut')"
@click="signOut"
></v-list-item>

</v-list>
</div>
</template>
Expand All @@ -281,24 +298,6 @@ onNuxtReady(async () => {
@click="createNewConversion()"
></v-btn>

<!-- <v-menu-->
<!-- >-->
<!-- <template v-slot:activator="{ props }">-->
<!-- <v-btn-->
<!-- v-bind="props"-->
<!-- icon="help_outline"-->
<!-- title="Feedback"-->
<!-- ></v-btn>-->
<!-- </template>-->
<!-- <v-list-->
<!-- >-->
<!-- <v-list-item-->
<!-- @click="feedback"-->
<!-- >-->
<!-- <v-list-item-title>{{ $t('feedback') }}</v-list-item-title>-->
<!-- </v-list-item>-->
<!-- </v-list>-->
<!-- </v-menu>-->
</v-app-bar>

<v-main>
Expand Down

0 comments on commit 727826f

Please sign in to comment.