Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onResponse in requests #17

Closed
zackify opened this issue Dec 21, 2016 · 2 comments
Closed

onResponse in requests #17

zackify opened this issue Dec 21, 2016 · 2 comments

Comments

@zackify
Copy link
Member

zackify commented Dec 21, 2016

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: '[email protected]',
    password: 'Tester'
  }}
`

Thoughts?

@raygesualdo
Copy link
Member

I like it. Very flexible and don't need a full "middleware" solution.

@zackify
Copy link
Member Author

zackify commented Feb 6, 2017

This is done and has been for a bit. works great!

@zackify zackify closed this as completed Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants