MCPcopy Create free account
hub / github.com/Botloader/botloader / restoreSession

Function restoreSession

frontend/src/modules/session/SessionContext.tsx:57–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 }
56
57 async function restoreSession() {
58 let token = localStorage.getItem("botloader_token");
59 if (token) {
60 // Got a token in storage, validate it and use it
61 let client = new ApiClient(CreateFetcher(), BuildConfig.botloaderApiBase, token);
62 await validateAndUpdateSession(client);
63 } else {
64 console.log("no token in local storage, no session to restore");
65 setSessionData({
66 apiClient: anonApiClient,
67 signingIn: false,
68 initialized: true,
69 });
70 }
71 }
72
73 async function logout() {
74 await sessionData.apiClient.logout();

Callers 1

SessionProviderFunction · 0.85

Calls 3

CreateFetcherFunction · 0.90
validateAndUpdateSessionFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected