diff --git a/changes/issue-6072-device-user-no-enroll-secret-api b/changes/issue-6072-device-user-no-enroll-secret-api new file mode 100644 index 0000000000..7d4db5b4f2 --- /dev/null +++ b/changes/issue-6072-device-user-no-enroll-secret-api @@ -0,0 +1 @@ +* Remove unnecessary call to enroll secret API on device user page when logged in \ No newline at end of file diff --git a/frontend/components/App/App.tsx b/frontend/components/App/App.tsx index 7dac815d1d..74e18927c2 100644 --- a/frontend/components/App/App.tsx +++ b/frontend/components/App/App.tsx @@ -84,7 +84,7 @@ const App = ({ children, location, router }: IAppProps): JSX.Element => { }; useEffect(() => { - if (authToken()) { + if (authToken() && !location?.pathname.includes("/device/")) { fetchCurrentUser(); } }, [location?.pathname]); @@ -97,7 +97,8 @@ const App = ({ children, location, router }: IAppProps): JSX.Element => { typeof isOnlyObserver !== "undefined" && !isOnlyObserver && typeof isAnyTeamMaintainerOrTeamAdmin !== "undefined" && - !isAnyTeamMaintainerOrTeamAdmin; + !isAnyTeamMaintainerOrTeamAdmin && + !location?.pathname.includes("/device/"); const getEnrollSecret = async () => { try {