Skip to content

Commit

Permalink
skip setup if in ssr mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed May 1, 2024
1 parent 86e2d40 commit 38e3fe8
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export function sequenceWaasWallet(params: BaseSequenceWaasConnectorOptions) {
params,

async setup() {
if (typeof window !== 'object') {
// (for SSR) only run in browser client
return
}

const provider = await this.getProvider()

if (params.googleClientId) {
Expand All @@ -86,11 +91,8 @@ export function sequenceWaasWallet(params: BaseSequenceWaasConnectorOptions) {

const isConnected = await provider.sequenceWaas.isSignedIn()
if (!isConnected) {
if (typeof window === 'object') {
// (for SSR) only run in browser client
const sessionHash = await provider.sequenceWaas.getSessionHash()
await config.storage?.setItem(LocalStorageKey.WaasSessionHash, sessionHash)
}
const sessionHash = await provider.sequenceWaas.getSessionHash()
await config.storage?.setItem(LocalStorageKey.WaasSessionHash, sessionHash)
}

provider.on('disconnect', () => {
Expand Down

0 comments on commit 38e3fe8

Please sign in to comment.