Slight simplification

This commit is contained in:
Eric van der Vlist 2023-03-02 16:35:10 +01:00
parent 12ae68f45e
commit 12bbc525dc
1 changed files with 7 additions and 8 deletions

View File

@ -84,8 +84,7 @@ const User: Component<Props> = (props) => {
return false; return false;
}; };
const addSubscriptionFactory = const addSubscription = (userDocument: any) => {
(username: string) => (userDocument: any) => {
const subscriptions = userDocument.subscriptions || []; const subscriptions = userDocument.subscriptions || [];
subscriptions.push({ username, direction: '' }); subscriptions.push({ username, direction: '' });
userDocument.subscriptions = subscriptions; userDocument.subscriptions = subscriptions;
@ -101,7 +100,7 @@ const User: Component<Props> = (props) => {
if (!isIn(subscription.username, subscriptions)) { if (!isIn(subscription.username, subscriptions)) {
update( update(
userId(subscription.username, database), userId(subscription.username, database),
addSubscriptionFactory(username), addSubscription,
defaultUserDocument defaultUserDocument
); );
console.log({ console.log({