Checking if location's hash contains an invitation
This commit is contained in:
parent
5753245dad
commit
bedcaa209a
|
@ -63,15 +63,34 @@ const [getMap, setMap] = createSignal<OlMap | null>(null);
|
|||
|
||||
export { getMap };
|
||||
|
||||
const useHash = () => useLocation().hash;
|
||||
|
||||
const Map: Component = () => {
|
||||
const navigate = useNavigate();
|
||||
const params = useParams();
|
||||
|
||||
createEffect(() => {
|
||||
console.log({ caller: 'Map / createEffect', hash: useHash() });
|
||||
});
|
||||
const hash = location.hash;
|
||||
console.log({ caller: 'Map / hash', hash });
|
||||
|
||||
const [invitation, setInvitation] = createSignal<any>(false);
|
||||
|
||||
if (hash.length > 1) {
|
||||
try {
|
||||
const payload = hash.slice(1);
|
||||
const decoded = atob(payload);
|
||||
const url = new URL(decoded);
|
||||
setInvitation(url);
|
||||
console.log({
|
||||
caller: 'Map',
|
||||
hash,
|
||||
invitation: decoded,
|
||||
});
|
||||
} catch {
|
||||
console.warn({
|
||||
caller: 'Map',
|
||||
hash,
|
||||
message: 'Hash is not a base64 encoded URL',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// See https://stackoverflow.com/questions/71288670/how-to-make-fullscreen-ionic-capacitor-app
|
||||
AndroidFullScreen.isImmersiveModeSupported()
|
||||
|
@ -296,7 +315,7 @@ const Map: Component = () => {
|
|||
return (
|
||||
//<OsmFetch map={getMap} />
|
||||
// @ts-ignore
|
||||
<div class="ol-map" ref={target}>
|
||||
<div class='ol-map' ref={target}>
|
||||
<Overlays map={getMap} />
|
||||
<Note />
|
||||
<Finder />
|
||||
|
|
Loading…
Reference in New Issue