使用带有 redux 和 react-native 的 auth0 react lock 示例时遇到问题
Trouble using the auth0 react lock example with redux and react-native
关闭 auth0 锁反应 auth redux 示例:https://github.com/auth0-blog/redux-auth/tree/auth0-lock
并将其用于 React Native,我试图在 redux React Native 应用程序中调用 auth0 登录屏幕作为我的操作分派的一部分,但我收到错误 "Cannot have a non-function arg after a function arg"
那是什么错误意思是当我试图从动作调度中调用 auth0 锁定函数时为什么会发生这种情况?
// actions.js
function showLogin() {
return {
type: LOGIN_REQUEST,
};
}
function loginSuccess(profile, token) {
return {
type: LOGIN_SUCCESS,
profile,
token,
};
}
function loginError(err) {
return {
type: LOGIN_FAILURE,
err,
};
}
export function login() {
return (dispatch) => {
dispatch(showLogin());
// it seems to error on the next line here calling the auth0 login method
lock.show((err, profile, token) => {
if (err) {
// handle error
return dispatch(loginError(err));
}
return dispatch(loginSuccess(profile, token));
});
};
}
根据问题标签,我假设 lock
变量指的是 react-native-lock
中可用的 Auth0 锁。
如果是这样,API docs表示show
方法声明了两个参数options
和callback
,但你只是调用时传递单个参数.
关闭 auth0 锁反应 auth redux 示例:https://github.com/auth0-blog/redux-auth/tree/auth0-lock
并将其用于 React Native,我试图在 redux React Native 应用程序中调用 auth0 登录屏幕作为我的操作分派的一部分,但我收到错误 "Cannot have a non-function arg after a function arg"
那是什么错误意思是当我试图从动作调度中调用 auth0 锁定函数时为什么会发生这种情况?
// actions.js
function showLogin() {
return {
type: LOGIN_REQUEST,
};
}
function loginSuccess(profile, token) {
return {
type: LOGIN_SUCCESS,
profile,
token,
};
}
function loginError(err) {
return {
type: LOGIN_FAILURE,
err,
};
}
export function login() {
return (dispatch) => {
dispatch(showLogin());
// it seems to error on the next line here calling the auth0 login method
lock.show((err, profile, token) => {
if (err) {
// handle error
return dispatch(loginError(err));
}
return dispatch(loginSuccess(profile, token));
});
};
}
根据问题标签,我假设 lock
变量指的是 react-native-lock
中可用的 Auth0 锁。
如果是这样,API docs表示show
方法声明了两个参数options
和callback
,但你只是调用时传递单个参数.