等待功能条件无法正常工作

我试图在出现用户Auth / UnAuth情况时切换多个Apollo客户端。 我该怎么办?

userCheck()条件不能正常工作?

async function userCheck() {
  return await Auth.currentAuthenticatedUser()
    .then(() => {
      return true;
    })
    .catch(() => {
      return false;
    });
}

function createApolloClient(initialState) {
  const client = functionFirst();
  const clientPublic = functionSecond();

  if (userCheck()) {
    return client;
  }
  return clientPublic;
}
summaryproject 回答:等待功能条件无法正常工作

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3164119.html

大家都在问