Skip to content

Commit c7987be

Browse files
authored
Merge pull request #1012 from dacadeorg/fix/loading-other-profiles
fix: load other user's profile in profile/community slug page
2 parents 71afd1c + e3c02ac commit c7987be

File tree

1 file changed

+6
-5
lines changed
  • src/pages/profile/[username]/communities

1 file changed

+6
-5
lines changed

src/pages/profile/[username]/communities/[slug].tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ProfileLayout from "@/layouts/ProfileLayout";
77
import { GetServerSideProps } from "next";
88
import { wrapper } from "@/store";
99
import { fetchProfileCommunity } from "@/store/services/profile/profileCommunities.service";
10+
import { fetchUserProfile } from "@/store/services/profile/users.service";
1011

1112
export default function ProfileCommunities() {
1213
return (
@@ -24,12 +25,13 @@ ProfileCommunities.getLayout = function (page: ReactElement) {
2425
export const getServerSideProps: GetServerSideProps = wrapper.getServerSideProps((store) => async ({ locale, query }) => {
2526
try {
2627
const { slug, username } = query;
27-
28+
2829
const [{ data }, translations] = await Promise.all([
2930
store.dispatch(fetchProfileCommunity({ username: username as string, slug: slug as string })),
31+
store.dispatch(fetchUserProfile((username as string) || "")),
3032
serverSideTranslations(locale as string),
3133
]);
32-
34+
3335
return {
3436
props: {
3537
community: data.community,
@@ -39,10 +41,9 @@ export const getServerSideProps: GetServerSideProps = wrapper.getServerSideProps
3941
...translations,
4042
},
4143
};
42-
4344
} catch (error) {
4445
return {
45-
notFound: true
46-
}
46+
notFound: true,
47+
};
4748
}
4849
});

0 commit comments

Comments
 (0)