From 12bbc525dcc0b0723077a0686122b49bdc6bef4e Mon Sep 17 00:00:00 2001 From: evlist Date: Thu, 2 Mar 2023 16:35:10 +0100 Subject: [PATCH] Slight simplification --- src/components/user/User.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/user/User.tsx b/src/components/user/User.tsx index 6b709bc..d776094 100644 --- a/src/components/user/User.tsx +++ b/src/components/user/User.tsx @@ -84,13 +84,12 @@ const User: Component = (props) => { return false; }; - const addSubscriptionFactory = - (username: string) => (userDocument: any) => { - const subscriptions = userDocument.subscriptions || []; - subscriptions.push({ username, direction: '' }); - userDocument.subscriptions = subscriptions; - return { username, ...userDocument }; - }; + const addSubscription = (userDocument: any) => { + const subscriptions = userDocument.subscriptions || []; + subscriptions.push({ username, direction: '' }); + userDocument.subscriptions = subscriptions; + return { username, ...userDocument }; + }; const defaultUserDocument = { database, @@ -101,7 +100,7 @@ const User: Component = (props) => { if (!isIn(subscription.username, subscriptions)) { update( userId(subscription.username, database), - addSubscriptionFactory(username), + addSubscription, defaultUserDocument ); console.log({