From 96bb515a603499abb016d381f0bdb5bd51ebda92 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Mon, 27 Jun 2022 21:03:51 +1000 Subject: Enable client directly using server URL, while avoiding CORS restrictions --- src/util.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/util.ts') diff --git a/src/util.ts b/src/util.ts index 1ed019c..907cce5 100644 --- a/src/util.ts +++ b/src/util.ts @@ -2,23 +2,6 @@ * General utility functions */ -// For server requests -export async function getServerResponse(path: string, params: string){ - // Construct URL - let url = new URL(window.location.href); - url.pathname = path; - url.search = params; - // Query server - let responseObj; - try { - let response = await fetch(url.toString()); - responseObj = await response.json(); - } catch (error){ - console.log(`Error with querying ${url}: ${error}`); - return null; - } - return responseObj; -} // For detecting screen size export type Breakpoint = 'sm' | 'md' | 'lg'; export function getBreakpoint(): Breakpoint { @@ -31,8 +14,7 @@ export function getBreakpoint(): Breakpoint { return 'lg'; } } -// Dynamically obtains scroll bar width -// From stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript +// For getting scroll-bar width // From stackoverflow.com/questions/13382516/getting-scroll-bar-width-using-javascript export function getScrollBarWidth(){ // Create hidden outer div let outer = document.createElement('div'); -- cgit v1.2.3