File tree 1 file changed +7
-12
lines changed
1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change
1
+ import { config } from '../config/index' ;
1
2
import RouterClient from '../routerClients/RouterClient' ;
2
3
3
4
/**
@@ -6,21 +7,15 @@ import RouterClient from '../routerClients/RouterClient';
6
7
*/
7
8
export const logout = async ( routerClient ) => {
8
9
const authUrl = await routerClient . kindeClient . logout (
9
- routerClient . sessionManager ,
10
- {
11
- authUrlParams : Object . fromEntries ( routerClient . searchParams )
12
- }
13
- ) ;
14
-
15
- const postLogoutRedirectURL = routerClient . getSearchParam (
16
- 'post_logout_redirect_url'
10
+ routerClient . sessionManager
17
11
) ;
18
12
13
+ let postLogoutRedirectURL = routerClient . getSearchParam ( 'post_logout_redirect_url' ) || config . postLogoutRedirectURL ;
14
+ if ( postLogoutRedirectURL ?. startsWith ( '/' ) ) {
15
+ postLogoutRedirectURL = config . redirectURL + postLogoutRedirectURL ;
16
+ }
19
17
if ( postLogoutRedirectURL ) {
20
- await routerClient . sessionManager . setSessionItem (
21
- 'post_logout_redirect_url' ,
22
- postLogoutRedirectURL
23
- ) ;
18
+ authUrl . searchParams . set ( 'redirect' , postLogoutRedirectURL ) ;
24
19
}
25
20
26
21
return routerClient . redirect ( authUrl . toString ( ) ) ;
You can’t perform that action at this time.
0 commit comments