Skip to content

Commit

Permalink
fix: fix not redirect non exist user page to 404 (#941)
Browse files Browse the repository at this point in the history
Because

- We should re-direct non exist view to 404

This commit

- fix not redirect non exist user page to 404
  • Loading branch information
EiffelFly committed Feb 7, 2024
1 parent 3351262 commit 86a823f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 8 additions & 5 deletions packages/toolkit/src/lib/useEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,18 @@ export function useEntity(): UseEntitySuccessReturn | UseEntityFailedReturn {
}, [entity, namespaceType.isSuccess, namespaceType.data]);

React.useEffect(() => {
if (!namespaceType.isSuccess) return;

if (
entityName &&
pipelineName &&
connectorName &&
modelName &&
namespaceType.isSuccess
namespaceType.data === "NAMESPACE_RESERVED" ||
namespaceType.data === "NAMESPACE_AVAILABLE"
) {
setIsSuccess(true);
}

if (entityName && pipelineName && connectorName && modelName) {
setIsSuccess(true);
}
}, [
entityName,
pipelineName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export const UserProfileView = () => {
const user = useUser({
userName: entityObject.entityName,
accessToken: accessToken,
enabled: enabledQuery && entityObject.isSuccess,
enabled:
enabledQuery &&
entityObject.isSuccess &&
(entityObject.namespaceType === "NAMESPACE_ORGANIZATION" ||
entityObject.namespaceType === "NAMESPACE_USER"),
});

const pipelines = useUserPipelines({
Expand Down

0 comments on commit 86a823f

Please sign in to comment.