Skip to content

Commit 8f801b9

Browse files
committed
fix: user loader on profile when there is no data
1 parent b92481f commit 8f801b9

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

src/components/layout/Navbar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Colors } from "@/types/community";
1515
import classNames from "classnames";
1616
import Loader from "../ui/Loader";
1717
import { IRootState } from "@/store";
18+
import { User } from "@/types/bounty";
1819

1920
interface NavbarProps {
2021
settings?: {
@@ -38,13 +39,14 @@ interface NavbarProps {
3839
export default function Navbar({ settings, sidebarBurgerColor = false }: NavbarProps): ReactElement {
3940
const { t } = useTranslation();
4041
const router = useRouter();
41-
const { isAuthenticated, isAuthenticatedAndVerified, isAuthLoading } = useMultiSelector<
42+
const { isAuthenticated, isAuthenticatedAndVerified, isAuthLoading, authData } = useMultiSelector<
4243
unknown,
43-
{ isAuthenticated: boolean; isAuthenticatedAndVerified: boolean; isAuthLoading: boolean }
44+
{ isAuthenticated: boolean; isAuthenticatedAndVerified: boolean; isAuthLoading: boolean; authData: User }
4445
>({
4546
isAuthenticatedAndVerified: (state: IRootState) => authVerify(state),
4647
isAuthenticated: (state: IRootState) => authCheck(state),
4748
isAuthLoading: (state: IRootState) => state.auth.isAuthLoading,
49+
authData: (state: IRootState) => state.auth.data,
4850
});
4951

5052
const colors = useMemo(() => {
@@ -94,7 +96,7 @@ export default function Navbar({ settings, sidebarBurgerColor = false }: NavbarP
9496
</ul>
9597
)}
9698

97-
{isAuthLoading ? (
99+
{isAuthLoading && !authData ? (
98100
<ul className="ml-auto relative">
99101
<Loader isSmallSpinner />
100102
</ul>

src/store/index.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import walletsSlice from "./feature/user/wallets.slice";
3131
import walletsService from "./services/wallets.service";
3232
import userProfileService from "./services/profile/users.service";
3333
import bountiesService from "./services/bounties.service";
34-
// import profileReducer from "./feature/profile";
3534
import userReferralsSlice from "./feature/user/referrals.slice";
3635
import web3WalletSlice from "./feature/wallet.slice";
3736
import certificateSlice from "./feature/profile/certificate.slice";
@@ -86,13 +85,10 @@ export interface IRootState {
8685
courses: ReturnType<typeof courseSlice.reducer>;
8786
feedback: ReturnType<typeof feedbackSlice.reducer>;
8887
learningModules: ReturnType<typeof learningModulesSlice.reducer>;
89-
// profile: ReturnType<typeof profileReducer>;
90-
//testing
9188
profileCommunities: ReturnType<typeof communitiesProfile.reducer>;
9289
profileReputation: ReturnType<typeof reputationSlice.reducer>;
9390
profileUser: ReturnType<typeof userProfileSlice.reducer>;
9491
profileCertificate: ReturnType<typeof certificateSlice.reducer>;
95-
9692
certificates: ReturnType<typeof certificateSlice.reducer>;
9793
sumsubVerification: ReturnType<typeof sumsubVerificationSlice.reducer>;
9894
payouts: ReturnType<typeof payoutsSlice.reducer>;
@@ -118,26 +114,18 @@ export const makeStore = () =>
118114
[submissionsSlice.name]: submissionsSlice.reducer,
119115
[eventsSlice.name]: eventsSlice.reducer,
120116
[bountiesSlice.name]: bountiesSlice.reducer,
121-
[navigationSlice.name]: navigationSlice.reducer,
122-
[communitySlice.name]: communitySlice.reducer,
123-
[eventsSlice.name]: eventsSlice.reducer,
124-
[submissionsSlice.name]: submissionsSlice.reducer,
125-
[eventsSlice.name]: eventsSlice.reducer,
126117
[communitySlice.name]: communitySlice.reducer,
127118
[learningModulesSlice.name]: learningModulesSlice.reducer,
128119
[userProfileSlice.name]: userProfileSlice.reducer,
129120
[userReputationSlice.name]: userReputationSlice.reducer,
130121
[feedbackSlice.name]: feedbackSlice.reducer,
131122
[challengeSlice.name]: challengeSlice.reducer,
132123
[web3WalletSlice.name]: web3WalletSlice.reducer,
133-
[learningModulesSlice.name]: learningModulesSlice.reducer,
134124
[communityService.reducerPath]: communityService.reducer,
135125
[bountiesService.reducerPath]: bountiesService.reducer,
136-
[authService.reducerPath]: authService.reducer,
137126
[coursesService.reducerPath]: coursesService.reducer,
138127
[certificateService.reducerPath]: certificateService.reducer,
139128
[walletsService.reducerPath]: walletsService.reducer,
140-
[bountiesService.reducerPath]: bountiesService.reducer,
141129
[reputationProfileService.reducerPath]: reputationProfileService.reducer,
142130
[profileCommunitiesService.reducerPath]: profileCommunitiesService.reducer,
143131
[userService.reducerPath]: userService.reducer,
@@ -155,12 +143,8 @@ export const makeStore = () =>
155143
[challengeService.reducerPath]: challengeService.reducer,
156144
[scoreboardService.reducerPath]: scoreboardService.reducer,
157145
[invitesSlice.name]: invitesSlice.reducer,
158-
// profile: profileReducer,
159-
//testing
160146
[communitiesProfile.name]: communitiesProfile.reducer,
161147
[reputationSlice.name]: reputationSlice.reducer,
162-
[userProfileSlice.name]: userProfileSlice.reducer,
163-
// [certificateSlice.name]: certificateSlice.reducer,
164148
},
165149

166150
middleware: (getDefaultMiddleware) => {

0 commit comments

Comments
 (0)