Skip to content

Instantly share code, notes, and snippets.

View pauca's full-sized avatar

Pau Carrió pauca

  • Barcelona, Spain
View GitHub Profile
@cmnstmntmn
cmnstmntmn / api.js
Created August 15, 2018 21:30
m.request wrapper
// -- wrapper around m.request using #next branch
import m from 'mithril'
const api = {
request: (options) => {
options.config = xhr => {
xhr.setRequestHeader('Authorization', 'Bearer ' + api.token())
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
}