refactor(actions): phase 5 extract remaining direct service modules
This commit is contained in:
@@ -0,0 +1,93 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { BASE_URL } from "../core/env";
|
||||||
|
import { consoleLogger } from "../core/logger";
|
||||||
|
|
||||||
|
export const getNewAppeals = async (searchString) => {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(BASE_URL + "/api/admin/getnewappeals_api");
|
||||||
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
consoleLogger(error);
|
||||||
|
return error.response;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getNewAppealsPage = async (
|
||||||
|
searchString,
|
||||||
|
pageNumber,
|
||||||
|
orderBy,
|
||||||
|
fieldSort,
|
||||||
|
showNumberOfRecords
|
||||||
|
) => {
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
"/api/admin/getnewappeals_api?searchString=" +
|
||||||
|
searchString +
|
||||||
|
"&pageNumber=" +
|
||||||
|
pageNumber +
|
||||||
|
"&orderby=" +
|
||||||
|
orderBy +
|
||||||
|
"&fieldSort=" +
|
||||||
|
fieldSort +
|
||||||
|
"&showNumberOfRecords=" +
|
||||||
|
showNumberOfRecords
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
consoleLogger(error);
|
||||||
|
return error.response;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getNewDocumentsPaged = async (
|
||||||
|
pageNumber,
|
||||||
|
orderBy,
|
||||||
|
fieldSort,
|
||||||
|
showNumberOfRecords,
|
||||||
|
documentType,
|
||||||
|
documentOrigin,
|
||||||
|
selectedWeeks
|
||||||
|
) => {
|
||||||
|
console.log(
|
||||||
|
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
||||||
|
pageNumber +
|
||||||
|
"&orderby=" +
|
||||||
|
orderBy +
|
||||||
|
"&fieldSort=" +
|
||||||
|
fieldSort +
|
||||||
|
"&showNumberOfRecords=" +
|
||||||
|
showNumberOfRecords +
|
||||||
|
"&documentType=" +
|
||||||
|
documentType +
|
||||||
|
"&numberWeeks=" +
|
||||||
|
selectedWeeks +
|
||||||
|
"&documentOrigin=" +
|
||||||
|
documentOrigin
|
||||||
|
);
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
"/api/admin/getlatestdocuments_api?pageNumber=" +
|
||||||
|
pageNumber +
|
||||||
|
"&orderby=" +
|
||||||
|
orderBy +
|
||||||
|
"&fieldSort=" +
|
||||||
|
fieldSort +
|
||||||
|
"&showNumberOfRecords=" +
|
||||||
|
showNumberOfRecords +
|
||||||
|
"&documentType=" +
|
||||||
|
documentType +
|
||||||
|
"&numberWeeks=" +
|
||||||
|
selectedWeeks +
|
||||||
|
"&documentOrigin=" +
|
||||||
|
documentOrigin
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
consoleLogger(error);
|
||||||
|
return error.response;
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -2,6 +2,6 @@ import {
|
|||||||
getNewAppeals,
|
getNewAppeals,
|
||||||
getNewAppealsPage,
|
getNewAppealsPage,
|
||||||
getNewDocumentsPaged
|
getNewDocumentsPaged
|
||||||
} from "./legacyActionsService";
|
} from "./adminDirectService";
|
||||||
|
|
||||||
export { getNewAppeals, getNewAppealsPage, getNewDocumentsPaged };
|
export { getNewAppeals, getNewAppealsPage, getNewDocumentsPaged };
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { consoleLogger } from "../core/logger";
|
||||||
|
|
||||||
|
export const createCRMTask = async (formValues) => {
|
||||||
|
var queryUrl = "/api/endpoint/createcrmtask_api";
|
||||||
|
|
||||||
|
var data = formValues;
|
||||||
|
var config = {
|
||||||
|
method: "post",
|
||||||
|
url: queryUrl,
|
||||||
|
data: data
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await axios(config);
|
||||||
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
consoleLogger(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
import { createCRMTask } from "./legacyActionsService";
|
import { createCRMTask } from "./integrationDirectService";
|
||||||
|
|
||||||
export { createCRMTask };
|
export { createCRMTask };
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import { consoleLogger } from "../core/logger";
|
||||||
|
|
||||||
|
export const sendEmail = async (
|
||||||
|
templateId,
|
||||||
|
emailAddress,
|
||||||
|
personalisation,
|
||||||
|
reference
|
||||||
|
) => {
|
||||||
|
var mailData = {
|
||||||
|
"templateId": templateId,
|
||||||
|
"emailAddress": emailAddress,
|
||||||
|
"reference": reference,
|
||||||
|
"personalisation": personalisation
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.post("/api/email/notify", mailData);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
consoleLogger(error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
import { sendEmail } from "./legacyActionsService";
|
import { sendEmail } from "./notifyDirectService";
|
||||||
|
|
||||||
export { sendEmail };
|
export { sendEmail };
|
||||||
|
|||||||
Reference in New Issue
Block a user