@volter/twin-tiktok 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,11 @@ type Wire = { status: number; body: TtRow };
22
22
 
23
23
  function readSession(): Session | null {
24
24
  if (typeof sessionStorage === 'undefined') return null;
25
+ // the World signed these screens in as the account its config names (`signIn.as`): taken once, as a sign-in would
26
+ // (off the page once taken, and not again in this tab once the person signs out)
27
+ const w = window as { __VOLTER_SIGN_IN__?: { account: string; token: string } };
28
+ const given = sessionStorage.getItem('volter.signedOut') ? undefined : w.__VOLTER_SIGN_IN__; delete w.__VOLTER_SIGN_IN__;
29
+ if (given && !sessionStorage.getItem(SESSION_TOKEN)) { sessionStorage.setItem(SESSION_HANDLE, given.account); sessionStorage.setItem(SESSION_TOKEN, given.token); }
25
30
  const handle = sessionStorage.getItem(SESSION_HANDLE);
26
31
  const token = sessionStorage.getItem(SESSION_TOKEN);
27
32
  return handle && token ? { handle, token } : null;
@@ -442,7 +447,7 @@ function App() {
442
447
 
443
448
  const signOut = useCallback(() => {
444
449
  sessionStorage.removeItem(SESSION_HANDLE);
445
- sessionStorage.removeItem(SESSION_TOKEN);
450
+ sessionStorage.removeItem(SESSION_TOKEN); sessionStorage.setItem('volter.signedOut', '1');
446
451
  setSession(null);
447
452
  setMe(null);
448
453
  go('login');