Supporting invitations through geo URLs

This commit is contained in:
Eric van der Vlist 2023-03-05 10:04:18 +01:00
parent 47e0cd342e
commit 975297722a
1 changed files with 17 additions and 6 deletions

View File

@ -50,12 +50,19 @@ const User: Component<Props> = (props) => {
return { token: uuid(), subscriptions: [], ...values() }; return { token: uuid(), subscriptions: [], ...values() };
}; };
const invitationLink = () => { const invitationLink = (type = 'https') => {
// TODO: make these URLs configurable // TODO: make these URLs configurable
const configUrl = `https://admin.dyomedea.app/api/conf/${ if (type === 'https') {
getValues().token const configUrl = `https://admin.dyomedea.app/api/conf/${
}`; getValues().token
return `https://web.dyomedea.app#${btoa(configUrl)}`; }`;
return `https://web.dyomedea.app#${btoa(configUrl)}`;
} else {
const configUrl = `https://admin.dyomedea.app/api/conf/${
getValues().token
}`;
return `geo:?invitation=${btoa(configUrl)}`;
}
}; };
const submitHandler = async (values: any, context: any) => { const submitHandler = async (values: any, context: any) => {
@ -329,8 +336,12 @@ const User: Component<Props> = (props) => {
<h2>{userId(data('username'), data('database'))}</h2> <h2>{userId(data('username'), data('database'))}</h2>
</Show> </Show>
<h3> <h3>
Invitations :
<A href={invitationLink()} target='_blank'> <A href={invitationLink()} target='_blank'>
Invitation https
</A>
<A href={invitationLink('geo')} target='_blank'>
geo
</A> </A>
</h3> </h3>
<form use:form> <form use:form>