From 384b7edb6518727e2f25815aaaf0218da363e322 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 1 Jul 2024 16:47:18 -0500 Subject: [PATCH] wip --- packages/dota/src/db/watcher.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/dota/src/db/watcher.ts b/packages/dota/src/db/watcher.ts index 56970c62..51d45779 100644 --- a/packages/dota/src/db/watcher.ts +++ b/packages/dota/src/db/watcher.ts @@ -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) { @@ -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')