Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: user status change

shuai552681d487f6
diff --git a/ui/src/pages/Layout/index.tsx b/ui/src/pages/Layout/index.tsx
index 4f9c07ce..8179aca7 100644
--- a/ui/src/pages/Layout/index.tsx
+++ b/ui/src/pages/Layout/index.tsx
@@ -22,7 +22,6 @@ const Layout: FC = () => {
const { update: interfaceStoreUpdate } = interfaceStore();
const { data: siteSettings } = useSiteSettings();
const { data: userStatus } = useCheckUserStatus();
- const user = Storage.get('userInfo');
useEffect(() => {
if (siteSettings) {
siteStoreUpdate(siteSettings.general);
@@ -39,6 +38,7 @@ const Layout: FC = () => {
if (!isMounted) {
isMounted = true;
const lang = Storage.get('LANG');
+ const user = Storage.get('userInfo');
if (user) {
updateUser(user);
}
@@ -47,9 +47,12 @@ const Layout: FC = () => {
}
}
- if (userStatus?.status && userStatus.status !== user.status) {
- user.status = userStatus?.status;
- updateUser(user);
+ if (userStatus?.status) {
+ const user = Storage.get('userInfo');
+ if (userStatus.status !== user.status) {
+ user.status = userStatus?.status;
+ updateUser(user);
+ }
}
return (