Apply expired logic

This commit is contained in:
Eric Bailey
2024-04-03 17:29:17 -05:00
parent cd5b555b08
commit 0ba76deb0c
+13 -2
View File
@@ -274,6 +274,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
createPersistSessionHandler( createPersistSessionHandler(
account, account,
({expired, refreshedAccount}) => { ({expired, refreshedAccount}) => {
if (expired) {
__globalAgent = PUBLIC_BSKY_AGENT
}
upsertAccount(refreshedAccount, expired) upsertAccount(refreshedAccount, expired)
}, },
{networkErrorCallback: clearCurrentAccount}, {networkErrorCallback: clearCurrentAccount},
@@ -319,6 +322,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
createPersistSessionHandler( createPersistSessionHandler(
account, account,
({expired, refreshedAccount}) => { ({expired, refreshedAccount}) => {
if (expired) {
__globalAgent = PUBLIC_BSKY_AGENT
}
upsertAccount(refreshedAccount, expired) upsertAccount(refreshedAccount, expired)
}, },
{networkErrorCallback: clearCurrentAccount}, {networkErrorCallback: clearCurrentAccount},
@@ -364,8 +370,13 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
persistSession: createPersistSessionHandler( persistSession: createPersistSessionHandler(
account, account,
async ({expired, refreshedAccount}) => { async ({expired, refreshedAccount}) => {
__globalAgent = agent if (expired) {
await configureModeration(agent, account) __globalAgent = PUBLIC_BSKY_AGENT
} else {
__globalAgent = agent
await configureModeration(agent, account)
}
upsertAccount(refreshedAccount, expired) upsertAccount(refreshedAccount, expired)
}, },
{networkErrorCallback: clearCurrentAccount}, {networkErrorCallback: clearCurrentAccount},