wrapped calls in promise all
This commit is contained in:
+11
-4
@@ -70,10 +70,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
|
||||
const myCases = await getMyCases();
|
||||
const myRepresentations = await getMyRepresentations();
|
||||
const watchedCases = await getWatchedCases();
|
||||
const awaitingSubmission = await getAwaitingSubmission();
|
||||
const [
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
] = await Promise.all([
|
||||
await getMyCases(),
|
||||
await getMyRepresentations(),
|
||||
await getWatchedCases(),
|
||||
await getAwaitingSubmission(),
|
||||
]);
|
||||
|
||||
store.dispatch(setMyCases(myCases));
|
||||
store.dispatch(setMyRepresentations(myRepresentations));
|
||||
|
||||
@@ -154,15 +154,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
//console.log("the query", query);
|
||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||
const appealTypeData = await getAppealsTypes();
|
||||
const formdata = (await getFormData(query.appealtypes)) || null;
|
||||
const [appealTypeData, formdata] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getFormData(query.appealtypes),
|
||||
]);
|
||||
|
||||
const caseReference = createCase("asasa", "asasa");
|
||||
|
||||
let xmlStr = formdata;
|
||||
xmlStr = formdata.value[0].formxml;
|
||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
store.dispatch(setForm(xmlStr));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -75,10 +75,10 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const appealTypeData = await getAppealsTypes();
|
||||
const lpaData = await getLPA();
|
||||
console.log("appeal types", appealTypeData);
|
||||
console.log("lpa typeswwwww", lpaData);
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user