Compare commits

...

1 Commits

Author SHA1 Message Date
Rafi
727826f1b1 Added a Sign-out button 2023-03-19 14:26:46 +08:00
3 changed files with 20 additions and 19 deletions

View File

@@ -33,6 +33,7 @@
"copy": "Copy", "copy": "Copy",
"copied": "Copied", "copied": "Copied",
"delete": "Delete", "delete": "Delete",
"signOut": "Sign out",
"welcomeScreen": { "welcomeScreen": {
"introduction1": "is an unofficial client for ChatGPT, but uses the official OpenAI API.", "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.", "introduction2": "You will need an OpenAI API Key before you can use this client.",

View File

@@ -33,6 +33,7 @@
"copy": "复制", "copy": "复制",
"copied": "已复制", "copied": "已复制",
"delete": "删除", "delete": "删除",
"signOut": "退出登录",
"welcomeScreen": { "welcomeScreen": {
"introduction1": "是一个非官方的ChatGPT客户端但使用OpenAI的官方API", "introduction1": "是一个非官方的ChatGPT客户端但使用OpenAI的官方API",
"introduction2": "在使用本客户端之前您需要一个OpenAI API密钥。", "introduction2": "在使用本客户端之前您需要一个OpenAI API密钥。",

View File

@@ -1,7 +1,7 @@
<script setup> <script setup>
import {useDisplay} from "vuetify"; import {useDisplay} from "vuetify";
const { $i18n } = useNuxtApp() const { $i18n, $auth } = useNuxtApp()
const runtimeConfig = useRuntimeConfig() const runtimeConfig = useRuntimeConfig()
const colorMode = useColorMode() const colorMode = useColorMode()
const drawer = ref(null) const drawer = ref(null)
@@ -88,6 +88,15 @@ const drawerPermanent = computed(() => {
return mdAndUp.value return mdAndUp.value
}) })
const signOut = async () => {
const { data, error } = await useFetch('/api/account/logout/', {
method: 'POST'
})
if (!error.value) {
await $auth.logout()
}
}
onNuxtReady(async () => { onNuxtReady(async () => {
loadConversations() loadConversations()
}) })
@@ -261,6 +270,14 @@ onNuxtReady(async () => {
:title="$t('feedback')" :title="$t('feedback')"
@click="feedback" @click="feedback"
></v-list-item> ></v-list-item>
<v-list-item
rounded="xl"
prepend-icon="logout"
:title="$t('signOut')"
@click="signOut"
></v-list-item>
</v-list> </v-list>
</div> </div>
</template> </template>
@@ -281,24 +298,6 @@ onNuxtReady(async () => {
@click="createNewConversion()" @click="createNewConversion()"
></v-btn> ></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-app-bar>
<v-main> <v-main>