dual-salmonD
Refineโ€ข4y agoโ€ข
16 replies
dual-salmon

Can't refetch Auth

I'm not sure if this is a refine or react problem, but the Router Provider keeps thinking I'm unauthenticated, but I'm not. Below is my code:

const { isFetching, refetch: checkAuth } = useAuthenticated();

const { mutate } = useUpdate();

useEffect(() => {
  if (isFetching) return;

  if (teamId && membershipId && secret && userId) {
    mutate(
      {
        dataProviderName: "teams",
        resource: teamsResources.membershipStatus,
        id: teamId,
        values: { membershipId, secret, userId },
      },
      {
        onSuccess: async () => {
          try {
            await checkAuth();

            list(Constants.collections.organizations);
          } catch (e) {
            console.error(e);
          }
        },
      }
    );
  }
}, [isFetching, membershipId, secret, teamId, userId]);


Any ideas?
Was this page helpful?