From 69f21fc3ce8f62ad576337a8d9e6592ea791dc03 Mon Sep 17 00:00:00 2001 From: Tatiana Lopaeva Date: Thu, 1 Feb 2024 10:12:09 +0300 Subject: [PATCH] Web: Added socket for personal quota. --- packages/client/src/Shell.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/client/src/Shell.jsx b/packages/client/src/Shell.jsx index d1291a9311..b3615cca30 100644 --- a/packages/client/src/Shell.jsx +++ b/packages/client/src/Shell.jsx @@ -59,6 +59,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => { currentDeviceType, timezone, showArticleLoader, + user, } = rest; const theme = useTheme(); @@ -149,13 +150,20 @@ const Shell = ({ items = [], page = "home", ...rest }) => { data: { roomParts: "quota" }, }); + console.log("user", user?.id); + user && + socketHelper.emit({ + command: "subscribe", + data: { roomParts: `QUOTA-${user.id}`, individual: true }, + }); + if (standalone && isPortalUnlimited) { socketHelper.emit({ command: "unsubscribe", data: { roomParts: "quota" }, }); } - }, [socketHelper, isPortalUnlimited]); + }, [socketHelper, isPortalUnlimited, user]); const { t, ready } = useTranslation(["Common"]); //TODO: if enable banner ["Common", "SmartBanner"] @@ -426,6 +434,7 @@ const ShellWrapper = inject(({ auth, backup, clientLoadingStore }) => { setProductVersion, language, currentQuotaStore, + userStore, } = auth; const { isPortalUnlimited } = currentQuotaStore; const { @@ -487,6 +496,7 @@ const ShellWrapper = inject(({ auth, backup, clientLoadingStore }) => { currentDeviceType, isPortalUnlimited, showArticleLoader: clientLoadingStore.showArticleLoader, + user: auth?.userStore?.user, }; })(observer(Shell));