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

fix(composable): disable caching & return error object #1

Merged
merged 1 commit into from
Jul 7, 2022
Merged

fix(composable): disable caching & return error object #1

merged 1 commit into from
Jul 7, 2022

Conversation

smarroufin
Copy link
Contributor

Description

I've had two issues using useNewsletterSubscribe.

  1. There is cache on the request so re-triggering a request with the same email only returns cache.
  2. I am not able to explore the error object, so I can determine if the error is about the user being already subscribed or anything else.

Fix

  1. Use $fetch instead of useFetch to always trigger the request without using cache.
  2. Catch the error exception and return the error object.

@netlify
Copy link

netlify bot commented Jul 6, 2022

Deploy Preview for nuxt-newsletter canceled.

Name Link
🔨 Latest commit 1d78676
🔍 Latest deploy log https://app.netlify.com/sites/nuxt-newsletter/deploys/62c59af89514ed0008050c48

@Baroshem
Copy link
Owner

Baroshem commented Jul 7, 2022

Nice work @smarroufin !

I am happy to merge it :)

@Baroshem Baroshem merged commit a734104 into Baroshem:main Jul 7, 2022
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

Successfully merging this pull request may close these issues.

2 participants