Skip to content

Commit e65fa32

Browse files
committed
fix: opt in to import.meta.* properties
1 parent a3a0630 commit e65fa32

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

playground/middleware/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default defineNuxtRouteMiddleware((to, from) => {
2-
if (process.server) { return }
2+
if (import.meta.server) { return }
33
const { $oidc } = useNuxtApp()
44
if (!$oidc.isLoggedIn) {
55
$oidc.login(to.fullPath)

src/runtime/plugin.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class Oidc {
6161

6262
async fetchUser() {
6363
try {
64-
if (process.server) {
64+
if (import.meta.server) {
6565
// console.log('serve-render: fetchUser from cookie.')
6666
const { config } = useRuntimeConfig()?.openidConnect
6767
const userinfoCookie = useCookie(config.cookiePrefix + 'user_info')
@@ -94,7 +94,7 @@ export class Oidc {
9494
}
9595

9696
login(redirect = '/') {
97-
if (process.client) {
97+
if (import.meta.client) {
9898
const params = new URLSearchParams({ redirect })
9999
const toStr = '/oidc/login?' + params.toString()
100100
window.location.replace(toStr)
@@ -103,7 +103,7 @@ export class Oidc {
103103

104104
logout() {
105105
// TODO clear user info when accessToken expired.
106-
if (process.client) {
106+
if (import.meta.client) {
107107
this.$useState.value.user = {}
108108
this.$useState.value.isLoggedIn = false
109109

src/runtime/storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class Storage {
106106
// origin from https://github.com/nuxt-community/auth-module
107107
isLocalStorageEnabled(): boolean {
108108
// Local Storage only exists in the browser
109-
if (!process.client) {
109+
if (!import.meta.client) {
110110
return false
111111
}
112112

0 commit comments

Comments
 (0)