Adding a token in user definition

This commit is contained in:
Eric van der Vlist 2023-03-03 09:15:38 +01:00
parent f77f7b5ea5
commit 77af32068c
1 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import { userExists } from '~/lib/user-exists';
import { update } from '~/lib/update';
import { replicationDocument } from '~/lib/replication-document';
import { get } from '~/lib/get';
import { v4 as uuid } from 'uuid';
interface Props {
values?: () => any;
@ -44,9 +45,9 @@ const User: Component<Props> = (props) => {
const getValues = () => {
if (isNew()) {
return { database, subscriptions: [] };
return { database, subscriptions: [], token: uuid() };
}
return { subscriptions: [], ...values() };
return { token: uuid(), subscriptions: [], ...values() };
};
const submitHandler = async (values: any, context: any) => {