diff --git a/src/covisart/Product.js b/src/covisart/Product.js index 6deffd2..35b4c22 100644 --- a/src/covisart/Product.js +++ b/src/covisart/Product.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Space, Table, notification } from 'antd'; +import { Space, Table, notification } from 'antd'; import { PhoneOutlined } from '@ant-design/icons'; import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'; @@ -11,7 +11,7 @@ import { useSnapshot } from 'valtio' import { state } from './store' import Configuration from './Configuration' import ReactGA from "react-ga4"; -import { Order } from './system/OrderRequest'; +import { Order, PingAPI } from './system/OrderRequest'; const Product = () => { const [selectedTab, setSelectedTab] = useState(0); @@ -40,14 +40,14 @@ const Product = () => { 'Dear ' + state.name + ', we got your order. Our sales team will contact with you for further operation. Thanks for your interest our NGS-360 family motion platform.', duration: 0, placement, - icon: + icon: }); }; - + const handleSubmit = event => { event.preventDefault(); // 👈️ prevent page refresh - - Order(state) + PingAPI(); + Order(state); openNotification('bottomRight') }; return ( diff --git a/src/covisart/store.js b/src/covisart/store.js index cdfe80f..f53aada 100644 --- a/src/covisart/store.js +++ b/src/covisart/store.js @@ -16,7 +16,7 @@ const state = proxy({ decal: 'three2', motors: ['BECKHOFF_AM8552', 'BECKHOFF_AM8052'], motor: 'BECKHOFF_AM8552', - speed: 1 + speed: 1, }) export { state } \ No newline at end of file diff --git a/src/covisart/system/OrderRequest.js b/src/covisart/system/OrderRequest.js index 554898f..703fc61 100644 --- a/src/covisart/system/OrderRequest.js +++ b/src/covisart/system/OrderRequest.js @@ -1,6 +1,8 @@ import Axios from "axios"; +import { useSnapshot } from 'valtio' +import { state } from '../store' -export const Order = (state) => { +export const Order = async (state) => { const data = { email: state.email, name: state.name, @@ -13,11 +15,21 @@ export const Order = (state) => { "string" ] } - Axios.post("https://ngsmarket.azurewebsites.net/api/Orders/", data,) + const resp = await Axios.post("https://ngsmarket.azurewebsites.net/api/Orders/", data,) .then((res) => { console.log(res) }) .catch((err) => { console.log(err) }); +}; + +export const PingAPI = () => { + const resp = Axios.get("https://ngsmarket.azurewebsites.net/api/Orders/") + .then((res) => { + console.log(res) + }) + .catch((err) => { + console.log(err) + }); }; \ No newline at end of file