From c5c6f0df694b44ea89e32db70629b7712a70d810 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 20 Sep 2021 20:00:25 +1000 Subject: [PATCH] Ensure credentials are passed along with API requests --- frontend/src/Maker.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Maker.tsx b/frontend/src/Maker.tsx index 544199e..f737215 100644 --- a/frontend/src/Maker.tsx +++ b/frontend/src/Maker.tsx @@ -31,7 +31,7 @@ interface CfdSellOrderPayload { } async function postCfdSellOrderRequest(payload: CfdSellOrderPayload) { - let res = await fetch(`/api/order/sell`, { method: "POST", body: JSON.stringify(payload) }); + let res = await fetch(`/api/order/sell`, { method: "POST", body: JSON.stringify(payload), credentials: "include" }); if (!res.status.toString().startsWith("2")) { console.log("Status: " + res.status + ", " + res.statusText); @@ -40,7 +40,7 @@ async function postCfdSellOrderRequest(payload: CfdSellOrderPayload) { } export default function App() { - let source = useEventSource({ source: "/api/feed" }); + let source = useEventSource({ source: "/api/feed", options: { withCredentials: true } }); const cfds = useLatestEvent(source, "cfds"); const order = useLatestEvent(source, "order");