Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import _fetch from 'fetch'
import Config from '../config/environment';
import Ember from 'ember'
export default Ember.Service.extend({
session: Ember.inject.service('session'),
fetch(url, options={}) {
return new Promise((resolve, reject) => {
this.get('session').authorize('authorizer:devise', (headerName, headerContent) => {
options = Object.assign({headers: {}}, options)
let authHeaders = {}
authHeaders[headerName] = headerContent
options["headers"] = Object.assign(options["headers"], authHeaders)
resolve(_fetch(`${}${url}`, options));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.