Adding an invitation link

This commit is contained in:
Eric van der Vlist 2023-03-03 09:27:44 +01:00
parent 77af32068c
commit 7513d723ef
1 changed files with 14 additions and 1 deletions

View File

@ -11,7 +11,7 @@ import {
import { TextField, Button, Progress } from '@kobalte/core';
import reporter from '@felte/reporter-tippy';
import './style.css';
import { useNavigate } from 'solid-start';
import { A, useNavigate } from 'solid-start';
import { adminCredentials } from '../credentials';
import { put } from '~/lib/put';
import { del } from '~/lib/del';
@ -50,6 +50,14 @@ const User: Component<Props> = (props) => {
return { token: uuid(), subscriptions: [], ...values() };
};
const invitationLink = () => {
// TODO: make these URLs configurable
const configUrl = `https://admin.dyomedea.app/api/conf/${
getValues().token
}`;
return `https://web.dyomedea.app#${btoa(configUrl)}`;
};
const submitHandler = async (values: any, context: any) => {
console.log({
caller: 'User / submitHandler',
@ -320,6 +328,11 @@ const User: Component<Props> = (props) => {
<Show when={!isNew()}>
<h2>{userId(data('username'), data('database'))}</h2>
</Show>
<h3>
<A href={invitationLink()} target='_blank'>
Invitation
</A>
</h3>
<form use:form>
<TextField.Root>
<TextField.Label>Mail address</TextField.Label>