diff options
Diffstat (limited to 'src/lib.ts')
| -rw-r--r-- | src/lib.ts | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -7,15 +7,22 @@ import {LayoutOptions} from './layout'; import {getBreakpoint, Breakpoint, getScrollBarWidth, onTouchDevice} from './util'; // For server requests -const SERVER_URL = 'http://localhost:8000/cgi-bin/data.py' +const SERVER_URL = 'http://localhost:3000/cgi-bin/data.py' export async function queryServer(params: URLSearchParams){ // Construct URL let url = new URL(SERVER_URL); - url.search = params.toString(); + //url.search = params.toString(); // Query server let responseObj; try { - let response = await fetch(url.toString()); + let response = await fetch(url.toString(), { + method: 'POST', + headers: { + 'Content-type': 'application/json', + }, + body: JSON.stringify({params: params.toString()}), + }); + console.log(response) responseObj = await response.json(); } catch (error){ console.log(`Error with querying ${url}: ${error}`); |
