Created
March 17, 2018 19:04
-
-
Save Kelin2025/a6015bfba802e031efaf2f643a275224 to your computer and use it in GitHub Desktop.
Apicase services extending
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApiService } from '@apicase/core' | |
import fetch from '@apicase/adapter-fetch' | |
/* Api root with global logger and API base */ | |
const ApiRoot = new ApiService(fetch, { url: '/api' }) | |
.on('error', logError) | |
/* Inherit options and event listeners from ApiRoot */ | |
const CreatePost = ApiRoot.extend({ | |
url: 'posts', | |
method: 'POST', | |
headers: { token: localStorage.getItem('token') } | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment