refactor: migrate myportal viewall account lookup to server helper
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user