Skip to content

Commit

Permalink
fix: don't use token when in cookie mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Aug 12, 2022
1 parent 74b839b commit 50b45bb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/preview/PreviewMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface PreviewModeProps extends PreviewSubscriptionProps {
authMode: 'dual' | 'token' | 'cookie'
onAuth: (authState: 'token' | 'cookie' | 'failed') => void
}
const PreviewModeComponent = ({authMode, onAuth, ...props}: PreviewModeProps) => {
const {projectId, token} = props
const PreviewModeComponent = ({authMode, onAuth, token, ...props}: PreviewModeProps) => {
const {projectId} = props
const authState = useAuthenticated({projectId, authMode, token})

useEffect(() => {
Expand All @@ -30,9 +30,9 @@ const PreviewModeComponent = ({authMode, onAuth, ...props}: PreviewModeProps) =>
case 'failed':
return null
case 'token':
return !props.EventSource && props.token ? (
return !props.EventSource && token ? (
<Suspense fallback={null}>
<PreviewSubscriptionWithToken {...props} token={props.token!} />
<PreviewSubscriptionWithToken {...props} token={token!} />
</Suspense>
) : (
<PreviewSubscription {...props} />
Expand Down

0 comments on commit 50b45bb

Please sign in to comment.