diff --git a/src/components/invitation/Invitation.tsx b/src/components/invitation/Invitation.tsx index bddacf6..208c72a 100644 --- a/src/components/invitation/Invitation.tsx +++ b/src/components/invitation/Invitation.tsx @@ -1,4 +1,6 @@ -import { Component, createSignal } from 'solid-js'; +import { Box, Button, TextField } from '@suid/material'; +import { Component, createEffect, createSignal, Show } from 'solid-js'; +import Dialog from '../dialog'; interface props {} @@ -13,12 +15,16 @@ export const searchInvitation = () => { const payload = hash.slice(1); const decoded = atob(payload); const url = new URL(decoded); - setInvitation(url); - console.log({ - caller: 'Invitation / searchInvitation', - hash, - invitation: decoded, - }); + fetch(url) + .then((response) => response.json()) + .then((data) => { + setInvitation({ url, data }); + console.log({ + caller: 'Invitation / searchInvitation', + hash, + invitation: invitation(), + }); + }); } catch { console.warn({ caller: 'Invitation / searchInvitation', @@ -30,7 +36,62 @@ export const searchInvitation = () => { }; const Invitation: Component = (props) => { - return <>; + createEffect(() => { + console.log({ + caller: 'Invitation / createEffect', + invitation: invitation(), + }); + }); + + const closeHandler = () => {}; + const submitHandler = async () => { + try { + const response = await fetch( + `${invitation().url.href}/${invitation().code}` + ); + const codeData = await response.json(); + setInvitation({ ...invitation(), codeData }); + } catch (error) {} + }; + + const codeChangeHandler = (event: any) => { + setInvitation({ ...invitation(), code: event.target.value }); + }; + + return ( + + +

+ Pour configurer cette application en tant que "{invitation().data.id} + ", copier le code qui vous a été envoyé par mail à l'adresse " + {invitation().data.mail}" :{' '} +

+ + +
+
+ ); }; export default Invitation; diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index e09f053..7b9c748 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -46,7 +46,7 @@ import { Overlays } from '../overlays/Overlays'; import Finder, { findLocation } from '../finder'; import { ZoomIn } from '@suid/icons-material'; import Note from '../note'; -import { searchInvitation } from '../invitation'; +import Invitation, { searchInvitation } from '../invitation'; const [getState, setState] = createSignal({ lon: 0, @@ -294,6 +294,7 @@ const Map: Component = () => { // // @ts-ignore
+