fix: Page optimization when the application is unavailable (#3580)
This commit is contained in:
parent
ea56fd6212
commit
b299ef0c53
@ -57,6 +57,8 @@ class AuthProfileSerializer(serializers.Serializer):
|
|||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
access_token = self.data.get("access_token")
|
access_token = self.data.get("access_token")
|
||||||
application_access_token = QuerySet(ApplicationAccessToken).filter(access_token=access_token).first()
|
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
|
application_id = application_access_token.application_id
|
||||||
profile = {
|
profile = {
|
||||||
'authentication': False
|
'authentication': False
|
||||||
|
|||||||
@ -37,9 +37,7 @@ router.beforeEach(
|
|||||||
try {
|
try {
|
||||||
authentication = await chatUser.isAuthentication()
|
authentication = await chatUser.isAuthentication()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
next({
|
next()
|
||||||
path: '/404',
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const p_token = to.query.token
|
const p_token = to.query.token
|
||||||
@ -86,7 +84,12 @@ router.beforeEach(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await chatUser.anonymousAuthentication()
|
try {
|
||||||
|
await chatUser.anonymousAuthentication()
|
||||||
|
} catch (e: any) {
|
||||||
|
next()
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!chatUser.application) {
|
if (!chatUser.application) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -25,11 +25,16 @@ const {
|
|||||||
|
|
||||||
const currentTemplate = computed(() => {
|
const currentTemplate = computed(() => {
|
||||||
let modeName = ''
|
let modeName = ''
|
||||||
if (!mode || mode === 'pc') {
|
if (chatUser.application) {
|
||||||
modeName = common.isMobile() ? 'mobile' : 'pc'
|
if (!mode || mode === 'pc') {
|
||||||
|
modeName = common.isMobile() ? 'mobile' : 'pc'
|
||||||
|
} else {
|
||||||
|
modeName = mode
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
modeName = mode
|
modeName = 'no-service'
|
||||||
}
|
}
|
||||||
|
|
||||||
const name = `/src/views/chat/${modeName}/index.vue`
|
const name = `/src/views/chat/${modeName}/index.vue`
|
||||||
return components[name].default
|
return components[name].default
|
||||||
})
|
})
|
||||||
|
|||||||
18
ui/src/views/chat/no-service/index.vue
Normal file
18
ui/src/views/chat/no-service/index.vue
Normal 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>
|
||||||
Loading…
Reference in New Issue
Block a user