File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
export default defineNuxtRouteMiddleware ( ( to , from ) => {
2
- if ( process . server ) { return }
2
+ if ( import . meta . server ) { return }
3
3
const { $oidc } = useNuxtApp ( )
4
4
if ( ! $oidc . isLoggedIn ) {
5
5
$oidc . login ( to . fullPath )
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export class Oidc {
61
61
62
62
async fetchUser ( ) {
63
63
try {
64
- if ( process . server ) {
64
+ if ( import . meta . server ) {
65
65
// console.log('serve-render: fetchUser from cookie.')
66
66
const { config } = useRuntimeConfig ( ) ?. openidConnect
67
67
const userinfoCookie = useCookie ( config . cookiePrefix + 'user_info' )
@@ -94,7 +94,7 @@ export class Oidc {
94
94
}
95
95
96
96
login ( redirect = '/' ) {
97
- if ( process . client ) {
97
+ if ( import . meta . client ) {
98
98
const params = new URLSearchParams ( { redirect } )
99
99
const toStr = '/oidc/login?' + params . toString ( )
100
100
window . location . replace ( toStr )
@@ -103,7 +103,7 @@ export class Oidc {
103
103
104
104
logout ( ) {
105
105
// TODO clear user info when accessToken expired.
106
- if ( process . client ) {
106
+ if ( import . meta . client ) {
107
107
this . $useState . value . user = { }
108
108
this . $useState . value . isLoggedIn = false
109
109
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ export class Storage {
106
106
// origin from https://github.com/nuxt-community/auth-module
107
107
isLocalStorageEnabled ( ) : boolean {
108
108
// Local Storage only exists in the browser
109
- if ( ! process . client ) {
109
+ if ( ! import . meta . client ) {
110
110
return false
111
111
}
112
112
You can’t perform that action at this time.
0 commit comments