Skip to content

Commit

Permalink
Merge pull request #131 from xi-effect/38985206
Browse files Browse the repository at this point in the history
38985206: 403 error if user have no access to channel
  • Loading branch information
unknownproperty authored Sep 19, 2024
2 parents 07f17f9 + 01570b7 commit 7373265
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/xi.front/app/(protected)/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ const ProtectedProvider = ({ children }: ProtectedProviderPropsT) => {
const updateCommunityMeta = useMainSt((state) => state.updateCommunityMeta);
const communityMeta = useMainSt((state) => state.communityMeta);
const onboardingStage = useMainSt((state) => state.user.onboardingStage);
const channels = useMainSt((state) => state.channels);

const isLogin = useMainSt((state) => state.isLogin);

const pathname = usePathname();
const router = useRouter();
const getUrlWithParams = useGetUrlWithParams();

useEffect(() => {
const channelIds = channels?.map(({ id }) => id);
if (params['channel-id'] && !channelIds?.includes(Number(params['channel-id']))) {
setErrorCode(403);
}
}, [params, channels]);

useEffect(() => {
if (onboardingStage !== 'completed') return;

Expand Down

0 comments on commit 7373265

Please sign in to comment.