fix page redirect when logout

This commit is contained in:
Nemo Godebski-Pedersen 2025-05-20 18:09:41 +07:00
parent 267cffba3b
commit f4fa0e4ce9
2 changed files with 18 additions and 5 deletions

View File

@ -49,10 +49,17 @@ export class UserController {
this.oauthInjectedService.requestTokenKey = undefined
this.oauthInjectedService.requestTokenSecret = undefined
session['clientConfig'] = undefined
if(!this.obpExplorerHome) {
console.error(`VITE_OBP_API_EXPLORER_HOST: ${this.obpExplorerHome}`)
if (request.query.redirect) {
response.redirect(request.query.redirect as string)
} else {
if(!this.obpExplorerHome) {
console.error(`VITE_OBP_API_EXPLORER_HOST: ${this.obpExplorerHome}`)
}
response.redirect(this.obpExplorerHome)
}
response.redirect(this.obpExplorerHome)
return response
}

View File

@ -112,6 +112,12 @@ watchEffect(() => {
}
}
})
const getCurrentPath = () => {
const currentPath = route.path
return currentPath
}
</script>
<template>
@ -157,11 +163,11 @@ watchEffect(() => {
<arrow-down />
</el-icon>
</span>-->
<a v-bind:href="'/api/connect?redirect='+ encodeURIComponent(route.path)" v-show="isShowLoginButton" class="login-button router-link">
<a v-bind:href="'/api/connect?redirect='+ encodeURIComponent(getCurrentPath())" v-show="isShowLoginButton" class="login-button router-link">
{{ $t('header.login') }}
</a>
<span v-show="isShowLogOffButton" class="login-user">{{ loginUsername }}</span>
<a v-bind:href="'/api/user/logoff'" v-show="isShowLogOffButton" class="logoff-button router-link">
<a v-bind:href="'/api/user/logoff?redirect=' + encodeURIComponent(getCurrentPath())" v-show="isShowLogOffButton" class="logoff-button router-link">
{{ $t('header.logoff') }}
</a>
</RouterView>