From 57e88b35a8df217e8db88983cf1fd1917f2eed0e Mon Sep 17 00:00:00 2001 From: wilsonplau Date: Thu, 3 Sep 2020 11:51:23 +0900 Subject: [PATCH] fix: check if nuxtState.env is defined --- lib/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugin.js b/lib/plugin.js index d897fc6..30e64e0 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -22,7 +22,7 @@ const strategies = { }, client (ctx, inject) { - const env = ctx.nuxtState !== undefined ? ctx.nuxtState.env : ctx.env + const env = ctx.nuxtState?.env ? ctx.nuxtState.env : ctx.env inject('env', env) } }