Commit 7b599b8c authored by John Lam's avatar John Lam

add new promo form working

parent 5207d84d
...@@ -7,19 +7,17 @@ export default function PromotionNewFormComponent () { ...@@ -7,19 +7,17 @@ export default function PromotionNewFormComponent () {
const { register, watch, handleSubmit, formState: { errors } } = useForm(); const { register, watch, handleSubmit, formState: { errors } } = useForm();
const onSubmit = (data) => { const onSubmit = (data) => {
console.log(data) console.log(data)
alert(JSON.stringify(data)); alert(JSON.stringify(data));
// fetch("localhost:8081/api/promotion", { fetch("http://localhost:8081/api/promos", {
// method: "POST", method: "POST",
// headers: { headers: {
// 'Content-Type': 'application/json', "Content-Type": "application/json",
// }, },
// body: JSON.stringify(data), body: JSON.stringify(data),
// }) })
// .then(res => res.json()) .then(res => res.json())
// .then(json => console.log(json)) .catch(err => console.log(err.data))
// .catch(err => console.log(err.data))
}; };
console.log(errors); console.log(errors);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment