Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Jul 1, 2024
1 parent c5638f3 commit 384b7ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/dota/src/db/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class SetupSupabase {
const newObj = payload.new
const oldObj = payload.old

if (newObj.scope !== oldObj.scope) {
const client = findUser(newObj.userId)
if (client?.Account) {
client.Account.scope = newObj.scope
}
}

// The frontend will set it to false when they relogin
// Which allows us to update the authProvider object
if (newObj.requires_refresh === false && oldObj.requires_refresh === true) {
Expand Down Expand Up @@ -136,10 +143,7 @@ class SetupSupabase {
}),
)
didTellUser.add(client.name.toLowerCase())
return
}

if (connectedUser.client.Account?.requires_refresh && betsEnabled) {
} else if (connectedUser.client.Account?.requires_refresh && betsEnabled) {
const { data, error } = await supabase
.from('bets')
.select('created_at')
Expand Down

0 comments on commit 384b7ed

Please sign in to comment.