Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Nuxt SSR设置Firebase脱机身份验证_Firebase_Authentication_Nuxt.js_Progressive Web Apps - Fatal编程技术网

如何使用Nuxt SSR设置Firebase脱机身份验证

如何使用Nuxt SSR设置Firebase脱机身份验证,firebase,authentication,nuxt.js,progressive-web-apps,Firebase,Authentication,Nuxt.js,Progressive Web Apps,我正在尝试使用@nuxtjs/firebase和@nuxtjs/pwa 我的身份验证在联机时按预期工作,但当用户脱机时,我在控制台中遇到此错误 asyncToGenerator.js:8 Uncaught (in promise) t {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachab

我正在尝试使用
@nuxtjs/firebase
@nuxtjs/pwa
我的身份验证在联机时按预期工作,但当用户脱机时,我在控制台中遇到此错误

asyncToGenerator.js:8 Uncaught (in promise) t {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred.", a: null}
以下是错误消息的屏幕截图:

此错误冻结我的应用程序(我的导航汉堡菜单没有响应)

numxt.config.js
中的PWA配置:

pwa:{
舱单:{
朗:"嗯",,
背景颜色:'#000000',
},
元:{
nativeUI:是的,
appleStatusBarStyle:'黑色',
主题颜色:'#000000',
},
配置:{
已启用:true
},
工作箱:{
进口文件:[
“/firebase auth sw.js”
],
dev:process.env.NODE_env===“开发”,
}
}
这是我在
numxt.config.js

firebase:{
配置:{
apiKey:process.env.apiKey,
authDomain:process.env.authDomain,
databaseURL:process.env.databaseURL,
projectId:process.env.projectId,
storageBucket:process.env.storageBucket,
messagingSenderId:process.env.messagingSenderId,
appId:process.env.appId,
measurementId:process.env.measurementId
},
服务:{
认证:{
ssr:没错,
初始化:{
//在自定义操作中使用来自操作的authData
//onAuthStateChangedMutation:“ON_AUTH_STATE_CHANGED_MUTATION”,
onAuthStateChangedAction:“onAuthStateChangedAction”
}
}
}
}
store/index.js
中的My
onAuthStateChangedAction

异步onAuthStateChangedAction({dispatch,commit},{authUser}){
如果(!authUser)返回提交(变异类型。删除用户)
//如果用户已通过身份验证
//从firestore获取经过身份验证的用户配置文件
分派('getUser',authUser)
if(process.browser)提交(MUTATION\u TYPE.SET\u TOKEN,localStorage.TOKEN)
}