diff options
Diffstat (limited to 'src/state/session')
-rw-r--r-- | src/state/session/index.tsx | 23 | ||||
-rw-r--r-- | src/state/session/types.ts | 2 |
2 files changed, 1 insertions, 24 deletions
diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index 582680e97..64f3837c7 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -35,7 +35,6 @@ const PUBLIC_BSKY_AGENT = new BskyAgent({service: PUBLIC_BSKY_SERVICE}) configureModerationForGuest() const StateContext = React.createContext<SessionStateContext>({ - isInitialLoad: true, isSwitchingAccounts: false, accounts: [], currentAccount: undefined, @@ -47,7 +46,6 @@ const ApiContext = React.createContext<SessionApiContext>({ login: async () => {}, logout: async () => {}, initSession: async () => {}, - resumeSession: async () => {}, removeAccount: () => {}, selectAccount: async () => {}, updateCurrentAccount: () => {}, @@ -67,7 +65,6 @@ type State = { } export function Provider({children}: React.PropsWithChildren<{}>) { - const [isInitialLoad, setIsInitialLoad] = React.useState(true) const [isSwitchingAccounts, setIsSwitchingAccounts] = React.useState(false) const [state, setState] = React.useState<State>({ accounts: persisted.get('session').accounts, @@ -389,21 +386,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) { [upsertAccount, clearCurrentAccount, createPersistSessionHandler], ) - const resumeSession = React.useCallback<SessionApiContext['resumeSession']>( - async account => { - try { - if (account) { - await initSession(account) - } - } catch (e) { - logger.error(`session: resumeSession failed`, {message: e}) - } finally { - setIsInitialLoad(false) - } - }, - [initSession], - ) - const removeAccount = React.useCallback<SessionApiContext['removeAccount']>( account => { setState(s => { @@ -547,11 +529,10 @@ export function Provider({children}: React.PropsWithChildren<{}>) { currentAccount: state.accounts.find( a => a.did === state.currentAccountDid, ), - isInitialLoad, isSwitchingAccounts, hasSession: !!state.currentAccountDid, }), - [state, isInitialLoad, isSwitchingAccounts], + [state, isSwitchingAccounts], ) const api = React.useMemo( @@ -560,7 +541,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) { login, logout, initSession, - resumeSession, removeAccount, selectAccount, updateCurrentAccount, @@ -571,7 +551,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) { login, logout, initSession, - resumeSession, removeAccount, selectAccount, updateCurrentAccount, diff --git a/src/state/session/types.ts b/src/state/session/types.ts index fbfac82e9..a2a9f8cf8 100644 --- a/src/state/session/types.ts +++ b/src/state/session/types.ts @@ -6,7 +6,6 @@ export type SessionAccount = PersistedAccount export type SessionStateContext = { accounts: SessionAccount[] currentAccount: SessionAccount | undefined - isInitialLoad: boolean isSwitchingAccounts: boolean hasSession: boolean } @@ -46,7 +45,6 @@ export type SessionApiContext = { */ clearCurrentAccount: () => void initSession: (account: SessionAccount) => Promise<void> - resumeSession: (account?: SessionAccount) => Promise<void> removeAccount: (account: SessionAccount) => void selectAccount: ( account: SessionAccount, |