refactor: migrate myportal viewall account lookup to server helper

This commit is contained in:
2026-11-06 11:58:01 +00:00
parent bf2e4a3254
commit c49b491698
2 changed files with 336 additions and 5 deletions
+22 -5
View File
@@ -14,10 +14,9 @@ import ServiceBanner from "../../components/myportal/servicebanner";
import { getSession } from "next-auth/react";
import pLimit from "p-limit";
import {
getPersonalAccount,
getPortalLogin
} from "../../actions/services/accountService";
import { getPortalLogin } from "../../actions/services/accountService";
import { getCrmPersonalAccount } from "../../lib/server/getCrmPersonalAccount";
import { consoleLogger } from "../../actions/core/logger";
import { getPortalModuleDetails } from "../../actions/services/caseService";
@@ -189,7 +188,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
};
}
const accountDetails = await getPersonalAccount(loggedInUser);
let accountDetails;
try {
accountDetails = await getCrmPersonalAccount(loggedInUser);
} catch (error) {
consoleLogger({
name: "MyPortalViewAllAccountLookup",
reasonCode: "UPSTREAM_FAILURE",
message: "myportal viewall personal account lookup failed",
error: error?.message
});
return {
redirect: {
destination: "/myportal/error",
permanent: false
}
};
}
if (!accountDetails || accountDetails.errorCode) {
return {