composition-api icon indicating copy to clipboard operation
composition-api copied to clipboard

feat: able to configure fetchKey with `useFetch` hook

Open DanSnow opened this issue 4 years ago â€ĸ 0 comments

🆒 Your use case I have several components which are using fetch hook, and these components may use over 100 times in total on a page. I need to add fetchKey for them so Nuxt can get the correct value. I want to reuse the data in setup hook to generate the fetchKey.

🆕 The solution you'd like Describe what you want to happen.

// this
useFetch(() => {...}, { key: 'foo' })
// and this
useFetch(() => {...}, { key: (getCounter) => `foo:${getCounter('foo')}` })

🔍 Alternatives you've considered Have you considered any alternative solutions or features?

â„šī¸ Additional info Is there any other context you think would be helpful to know?

DanSnow avatar Aug 10 '21 08:08 DanSnow