Created
March 17, 2018 19:08
-
-
Save Kelin2025/49cbe6ad0c8a3f3230f2a66d0631827f to your computer and use it in GitHub Desktop.
Apicase hooks + extend
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
const ApiRoot = ApiRoot.extend({ | |
url: '/api', | |
hooks: { | |
/* Inject our token and go to the next step */ | |
before ({ payload, next }) { | |
const token = localStorage.getItem('token') | |
next(withToken(token, payload)) | |
} | |
} | |
}) | |
const GetProfile = ApiRoot.extend({ url: 'profile' }) | |
const CreatePost = ApiRoot.extend({ url: 'profile', method: 'POST' }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment