Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
Rename 'state' to 'event'
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmaes committed Sep 20, 2023
1 parent 1ec9a4a commit de7ec16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/authMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export const createAuthMachine = (params: {
if (isSignedIn()) {
sendBack({ type: 'SIGNED_IN' });
}
ctx.client.auth.onAuthStateChange((state) => {
ctx.client.auth.onAuthStateChange((event, session) => {
// we only care about SIGNED_IN because signing out is "synchronous" from our perspective anyway
// and is handled in response to user actions
if (state === 'SIGNED_IN') {
if (event === 'SIGNED_IN') {
sendBack({ type: 'SIGNED_IN' });
}
});
Expand Down Expand Up @@ -121,7 +121,7 @@ export const createAuthMachine = (params: {
external_sign_in: {
entry: [
(_) => {
if (typeof window === undefined) return;
if (typeof window === 'undefined') return;
window.open(
`/registry/login?redirectTo=${encodeURIComponent(
window.location.pathname,
Expand All @@ -135,7 +135,7 @@ export const createAuthMachine = (params: {
tags: ['authorized'],
entry: [
(_) => {
if (typeof window === undefined) return;
if (typeof window === 'undefined') return;
window.open(
`/registry/logout?redirectTo=${encodeURIComponent(
window.location.pathname,
Expand Down

0 comments on commit de7ec16

Please sign in to comment.