mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-15 04:15:18 +08:00
4334e8a58e
Co-authored-by: José Valim <jose.valim@dashbit.co>
22 lines
461 B
JavaScript
22 lines
461 B
JavaScript
import { load, store } from "./storage";
|
|
|
|
const APP_AUTH_TOKEN_PREFIX = "app_auth_token:";
|
|
|
|
export function storeAppAuthToken(slug, token) {
|
|
store(APP_AUTH_TOKEN_PREFIX + slug, token);
|
|
}
|
|
|
|
export function loadAppAuthToken() {
|
|
const path = window.location.pathname;
|
|
|
|
if (path.startsWith("/apps/")) {
|
|
const slug = path.split("/")[2];
|
|
const token = load(APP_AUTH_TOKEN_PREFIX + slug);
|
|
|
|
if (token) {
|
|
return token;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|