Skip to content

Instantly share code, notes, and snippets.

@afontcu
Created August 7, 2018 17:49
Show Gist options
  • Save afontcu/c7a5fd5859e1e1af29c6909e42815e52 to your computer and use it in GitHub Desktop.
Save afontcu/c7a5fd5859e1e1af29c6909e42815e52 to your computer and use it in GitHub Desktop.
apiRequest({ // notice the curly braces! we are passing an object now
endpoint: 'products',
method: 'GET',
getParams: { category: 3 },
headers: ["Content-Type: text/plain"],
callback: function(response) {},
timeout: 0,
authRequest: true
})
// somewhere else:
function apiRequest({ // notice the curly braces! we are receiving an object now
endpoint,
method,
getParams,
headers,
callback,
timeout,
authRequest,
}) {
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment