1.0.4 • Published 3 years ago

ember-fetch-request v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

ember-fetch-request

Service for making Fetch requests in Ember applications. Mimics the ember-ajax magic over a plain ajax code. The way it builts the URL, works with the headers, handles errors, and provides a useful service.

  • customizable service
  • returns RSVP promises
  • improved error handling
  • ability to specify request headers

Getting started

If you're just starting out, you already have ember-ajax installed! However, if it's missing from your package.json, you can add it by doing:

ember install ember-fetch-request

To use the fetch service, inject the fetch-request service into your route or component.

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class AnyRoute extends Route {
  @service fetchRequest;
  model() {
    return this.fetchRequest.request('/posts');
  }
}

Fetch Request Service

//TODO: Translate ajax to fetch and update