Skip to content

Instantly share code, notes, and snippets.

View amir5000's full-sized avatar
Working

Amir5000 amir5000

Working
View GitHub Profile
@megamaddu
megamaddu / fetch-helpers.js
Last active December 23, 2019 19:44
Fetch API Helpers
import fetch from 'isomorphic-fetch'
const setupRequestOptions = (options = {}, overrideMethod) => {
if (overrideMethod) options.method = overrideMethod
if (!options.headers) options.headers = {}
options.credentials = 'same-origin'
return options
}
const setupJsonRequestOptions = (options, overrideMethod) => {