valeriangalliat / fetch-cookie

Decorator for a `fetch` function to support automatic cookie storage and population. 🍪
The Unlicense
135 stars 29 forks source link

Unable to use import syntax #61

Closed joshmsamuels closed 3 years ago

joshmsamuels commented 3 years ago

Hi,

I am unfamiliar with how to use the new import syntax with this package so I was thinking it might not play nicely with the way the export was defined.

I would be happy to create a PR if this is an issue and we can decide on the correct approach since I cannot think of one that would not be a breaking change to the existing API.

valeriangalliat commented 3 years ago

Hey! You should be able to use import { default as fetchCookie } from 'fetch-cookie'

Let me know if that works for you :)

joshmsamuels commented 3 years ago

yup that did solve the issue thanks a lot!

For anyone else that sees this -- to get the fetch function you need to call fetchCookie with your fetch function after the import statement

import { default as fetchCookie } from 'fetch-cookie'
const fetchWithCookies = fetchCookie(fetchFunc)

(sorry for not closing this sooner)