You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
675 B
25 lines
675 B
3 years ago
|
import { HttpError } from "./components/HttpError";
|
||
|
|
||
3 years ago
|
export interface CfdSellOrderPayload {
|
||
|
price: number;
|
||
|
min_quantity: number;
|
||
|
max_quantity: number;
|
||
|
}
|
||
|
|
||
|
export async function postCfdSellOrderRequest(payload: CfdSellOrderPayload) {
|
||
|
let res = await fetch(`/api/order/sell`, {
|
||
|
method: "POST",
|
||
|
body: JSON.stringify(payload),
|
||
|
headers: {
|
||
|
"Content-Type": "application/json",
|
||
|
},
|
||
|
credentials: "include",
|
||
|
});
|
||
|
|
||
|
if (!res.status.toString().startsWith("2")) {
|
||
|
console.log("Status: " + res.status + ", " + res.statusText);
|
||
3 years ago
|
const resp = await res.json();
|
||
|
throw new HttpError(resp);
|
||
3 years ago
|
}
|
||
|
}
|