From 77af32068c8a9a30bc66d8b8f596e74109a441e1 Mon Sep 17 00:00:00 2001 From: evlist Date: Fri, 3 Mar 2023 09:15:38 +0100 Subject: [PATCH] Adding a token in user definition --- src/components/user/User.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/user/User.tsx b/src/components/user/User.tsx index 6fef8ef..a6bd43d 100644 --- a/src/components/user/User.tsx +++ b/src/components/user/User.tsx @@ -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) => { 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) => {