Fix the bug of conversation title

This commit is contained in:
Rafi
2023-04-01 21:54:15 +08:00
parent f20a3562f3
commit 8ff914582a
3 changed files with 8 additions and 8 deletions

View File

@@ -54,7 +54,6 @@ const deleteConversation = async (index) => {
deletingConversationIndex.value = null
if (!error.value) {
if (conversations.value[index].id === currentConversation.value.id) {
console.log('delete current conversation')
createNewConversation()
}
conversations.value.splice(index, 1)
@@ -331,14 +330,14 @@ onMounted(async () => {
>
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title>{{ currentConversation.topic ?? runtimeConfig.public.appName }}</v-toolbar-title>
<v-toolbar-title>{{ currentConversation.id ? currentConversation.topic : runtimeConfig.public.appName }}</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
:title="$t('newConversation')"
icon="add"
@click="createNewConversation()"
@click="createNewConversation"
class="d-md-none"
></v-btn>
<v-btn

View File

@@ -11,7 +11,8 @@ const conversation = ref(getDefaultConversationData())
const loadConversation = async () => {
const { data, error } = await useAuthFetch('/api/chat/conversations/' + route.params.id)
if (!error.value) {
conversation.value = data.value
conversation.value = Object.assign(conversation.value, data.value)
console.log(conversation.value)
}
}
@@ -24,7 +25,6 @@ const loadMessage = async () => {
onActivated(async () => {
console.log('activated')
console.log(conversation.value)
if (route.params.id) {
conversation.value.loadingMessages = true
await loadConversation()
@@ -33,9 +33,12 @@ onActivated(async () => {
} else {
conversation.value = getDefaultConversationData()
}
console.log(conversation.value)
currentConversation.value = Object.assign({}, conversation.value)
})
watchEffect(() => {
console.log('conversation.value', conversation.value)
})
</script>
<template>

View File

@@ -18,8 +18,6 @@ export const getConversations = async () => {
}
export const createNewConversation = () => {
const conversation = useConversation()
conversation.value = getDefaultConversationData()
navigateTo('/')
}