Moving invitation check in its own module
This commit is contained in:
parent
bedcaa209a
commit
5ad98a860e
|
@ -0,0 +1,36 @@
|
||||||
|
import { Component, createSignal } from 'solid-js';
|
||||||
|
|
||||||
|
interface props {}
|
||||||
|
|
||||||
|
const [invitation, setInvitation] = createSignal<any>(false);
|
||||||
|
|
||||||
|
export const searchInvitation = () => {
|
||||||
|
const hash = location.hash;
|
||||||
|
console.log({ caller: 'Invitation / searchInvitation', hash });
|
||||||
|
|
||||||
|
if (hash.length > 1) {
|
||||||
|
try {
|
||||||
|
const payload = hash.slice(1);
|
||||||
|
const decoded = atob(payload);
|
||||||
|
const url = new URL(decoded);
|
||||||
|
setInvitation(url);
|
||||||
|
console.log({
|
||||||
|
caller: 'Invitation / searchInvitation',
|
||||||
|
hash,
|
||||||
|
invitation: decoded,
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
console.warn({
|
||||||
|
caller: 'Invitation / searchInvitation',
|
||||||
|
hash,
|
||||||
|
message: 'Hash is not a base64 encoded URL',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const Invitation: Component<props> = (props) => {
|
||||||
|
return <></>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Invitation;
|
|
@ -0,0 +1 @@
|
||||||
|
export { default, searchInvitation } from './Invitation';
|
|
@ -46,6 +46,7 @@ import { Overlays } from '../overlays/Overlays';
|
||||||
import Finder, { findLocation } from '../finder';
|
import Finder, { findLocation } from '../finder';
|
||||||
import { ZoomIn } from '@suid/icons-material';
|
import { ZoomIn } from '@suid/icons-material';
|
||||||
import Note from '../note';
|
import Note from '../note';
|
||||||
|
import { searchInvitation } from '../invitation';
|
||||||
|
|
||||||
const [getState, setState] = createSignal({
|
const [getState, setState] = createSignal({
|
||||||
lon: 0,
|
lon: 0,
|
||||||
|
@ -67,30 +68,7 @@ const Map: Component = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
||||||
const hash = location.hash;
|
searchInvitation();
|
||||||
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
|
// See https://stackoverflow.com/questions/71288670/how-to-make-fullscreen-ionic-capacitor-app
|
||||||
AndroidFullScreen.isImmersiveModeSupported()
|
AndroidFullScreen.isImmersiveModeSupported()
|
||||||
|
|
Loading…
Reference in New Issue