Email sending framework in place with nodemailer. Some rendering is happening dynamically, but i todesn't bring in most styles.
This commit is contained in:
@@ -1,9 +1,42 @@
|
||||
import React from 'react'
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import React from "react";
|
||||
import { useApolloClient } from "react-apollo";
|
||||
import ReactDOMServer from "react-dom/server";
|
||||
import { REPORT_QUERY_PARTS_ORDER_BY_PK } from "../../graphql/parts-orders.queries";
|
||||
import ReportPartsOrder from "../../reports/pages/parts-order/parts-order.component";
|
||||
|
||||
export default function ManageRootPageComponent() {
|
||||
return (
|
||||
<div>
|
||||
Temporary Home Page.
|
||||
</div>
|
||||
)
|
||||
const client = useApolloClient();
|
||||
return (
|
||||
<div>
|
||||
<Button
|
||||
onClick={() => {
|
||||
client
|
||||
.query({
|
||||
query: REPORT_QUERY_PARTS_ORDER_BY_PK,
|
||||
variables: { id: "ebe0fb6b-6ec4-4ae0-8fdc-49bdf1e37ff3" },
|
||||
fetchPolicy: "network-only"
|
||||
})
|
||||
.then(response => {
|
||||
axios.post("/sendemail", {
|
||||
from: { name: "Kavia Autobody" },
|
||||
to: "snaptsoft@gmail.com",
|
||||
replyTo: "patrickwf@gmail.com",
|
||||
subject: "Sending Email using Node.js",
|
||||
text: "Plaintext version of the message",
|
||||
html: ReactDOMServer.renderToStaticMarkup(
|
||||
<ReportPartsOrder
|
||||
order={response.data.parts_orders_by_pk}
|
||||
bodyshop={response.data.bodyshops[0]}
|
||||
/>
|
||||
)
|
||||
});
|
||||
});
|
||||
}}>
|
||||
Test Email
|
||||
</Button>
|
||||
<div>Testing Section-Report</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user