fix: Page optimization when the application is unavailable (#3580)

This commit is contained in:
shaohuzhang1 2025-07-14 14:09:31 +08:00 committed by GitHub
parent ea56fd6212
commit b299ef0c53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 7 deletions

View File

@ -57,6 +57,8 @@ class AuthProfileSerializer(serializers.Serializer):
self.is_valid(raise_exception=True)
access_token = self.data.get("access_token")
application_access_token = QuerySet(ApplicationAccessToken).filter(access_token=access_token).first()
if application_access_token is None:
raise NotFound404(404, _("Invalid access_token"))
application_id = application_access_token.application_id
profile = {
'authentication': False

View File

@ -37,9 +37,7 @@ router.beforeEach(
try {
authentication = await chatUser.isAuthentication()
} catch (e: any) {
next({
path: '/404',
})
next()
return
}
const p_token = to.query.token
@ -86,7 +84,12 @@ router.beforeEach(
}
}
} else {
await chatUser.anonymousAuthentication()
try {
await chatUser.anonymousAuthentication()
} catch (e: any) {
next()
return
}
}
if (!chatUser.application) {
try {

View File

@ -25,11 +25,16 @@ const {
const currentTemplate = computed(() => {
let modeName = ''
if (!mode || mode === 'pc') {
modeName = common.isMobile() ? 'mobile' : 'pc'
if (chatUser.application) {
if (!mode || mode === 'pc') {
modeName = common.isMobile() ? 'mobile' : 'pc'
} else {
modeName = mode
}
} else {
modeName = mode
modeName = 'no-service'
}
const name = `/src/views/chat/${modeName}/index.vue`
return components[name].default
})

View File

@ -0,0 +1,18 @@
<template>
<div class="not-found-container flex-center">
<div>
<img src="@/assets/500.png" width="250" alt="" />
<h4 class="text-center">{{ $t('common.notFound.NoService') }}</h4>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
const router = useRouter()
</script>
<style lang="scss" scoped>
.not-found-container {
height: 100vh;
width: 100vw;
}
</style>