feat(FN-3406): add shell context hook plumbing for dashboard
Adds a new `useShellContext` hook with tests to the dashboard, integrated into `App.tsx` and `Header.tsx` to provide shell context plumbing throughout the UI. Fusion-Task-Id: FN-3406
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = "fn.authToken";
|
||||
const URL_PARAM = "token";
|
||||
export const URL_TOKEN_PARAM = "token";
|
||||
/** Query param name used when we can't set an Authorization header (EventSource, WebSocket). */
|
||||
export const QUERY_TOKEN_PARAM = "fn_token";
|
||||
|
||||
@@ -76,13 +76,13 @@ function captureTokenFromUrl(): string | undefined {
|
||||
|
||||
try {
|
||||
const url = new URL(window.location.href);
|
||||
const token = url.searchParams.get(URL_PARAM);
|
||||
const token = url.searchParams.get(URL_TOKEN_PARAM);
|
||||
if (!token) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
writeStoredToken(token);
|
||||
url.searchParams.delete(URL_PARAM);
|
||||
url.searchParams.delete(URL_TOKEN_PARAM);
|
||||
const cleaned = url.pathname + (url.search ? url.search : "") + url.hash;
|
||||
window.history.replaceState(window.history.state, "", cleaned);
|
||||
return token;
|
||||
|
||||
Reference in New Issue
Block a user