()
| 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(); |
no test coverage detected