change login checking for chat widget

This commit is contained in:
Nemo Godebski-Pedersen 2025-03-21 12:03:56 +00:00
parent c6b0dd5a42
commit ceb6f5c485
2 changed files with 4 additions and 3 deletions

1
components.d.ts vendored
View File

@ -48,6 +48,7 @@ declare module 'vue' {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SearchNav: typeof import('./src/components/SearchNav.vue')['default']
StandaloneChat: typeof import('./src/components/StandaloneChat.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']

View File

@ -47,14 +47,14 @@ export default {
methods: {
async toggleChat() {
this.chatOpen = !this.chatOpen
if (!this.chat.userIsAuthenticated) {
await this.chat.handleAuthentication()
}
},
async checkLoginStatus(): Promise<boolean> {
const currentUser = await getCurrentUser()
const currentResponseKeys = Object.keys(currentUser)
if (currentResponseKeys.includes('username')) {
if (!this.chat.userIsAuthenticated) {
await this.chat.handleAuthentication()
}
return true
} else {
return false