This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function jsonFetch<T>( | |
url: string, | |
options: RequestInit = {} | |
): Promise<T> { | |
// Set the default headers correctly | |
const headers: HeadersInit = new Headers(options.headers); | |
headers.set('Accept', 'application/json'); | |
headers.set('Content-Type', 'application/json'); | |
return fetch(url, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const corsHeaders = { | |
'Access-Control-Allow-Origin': '*', | |
'Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS', | |
'Access-Control-Allow-Credentials': true, | |
}; | |
const ALLOWED_HOSTS = [ | |
// Put your allowed cors hosts here | |
// By default localhost is allowed | |
// Your fetch should have a `mode: cors` enabled for it to work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Pavan Kumar Sunkara | |
email = [email protected] | |
username = pksunkara | |
[init] | |
defaultBranch = master | |
[core] | |
editor = nvim | |
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
pager = delta |