onResponse in requests
zackify opened this issue · 2 comments
zackify commented
What if we did:
import { partial } from 'legible'
const twitter = {
register: partial`
url: https://api.twitter.com/register,
method: POST
headers: ${{ Authorization: localStorage.getItem('authorization') }}
onResponse: ${response => {
localStorage.setItem({ authorization: response.headers.get('Authorization') })
}}
`
}
twitter.register`
body: ${{
email: 'test@test.com',
password: 'Tester'
}}
`
Thoughts?
raygesualdo commented
I like it. Very flexible and don't need a full "middleware" solution.
zackify commented
This is done and has been for a bit. works great!