Slight simplification
This commit is contained in:
parent
12ae68f45e
commit
12bbc525dc
|
@ -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({
|
||||||
|
|
Loading…
Reference in New Issue