Browse Source
Ensure credentials are passed along with API requests
no-contract-setup-message
Thomas Eizinger
3 years ago
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
1 changed files with
2 additions and
2 deletions
-
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<Cfd[]>(source, "cfds"); |
|
|
|
const order = useLatestEvent<Order>(source, "order"); |
|
|
|