Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

docs: add useRequestEvent - #5326

Merged
pi0 merged 5 commits into
mainfrom
docs/use-req-event
Jun 9, 2022
Merged

docs: add useRequestEvent#5326
pi0 merged 5 commits into
mainfrom
docs/use-req-event

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#14099

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds some docs about useRequestEvent.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroedanielroe added the documentation Improvements or additions to documentation label Jun 7, 2022
@danielroe
danielroe requested a review from pi0June 7, 2022 11:57
@danielroedanielroe self-assigned this Jun 7, 2022
@netlify

netlifyBot commented Jun 7, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs ready!

NameLink
🔨 Latest commitb080150
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62a189667b2d3b0009d84e32
😎 Deploy Previewhttps://deploy-preview-5326--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

const event = useRequestEvent()

// Get cookies for the event
const cookies = useCookies(event)

@pi0pi0Jun 8, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even expose useCookies to the app outside of server? Accessing event.req might be more a more clear example...

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to pick something that is event-based rather than req/res. Perhaps could import directly?

@pi0pi0Jun 9, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't include an h3 example for outside of server. Perhaps a usage of event.context? But i believe showing how to access req within the app namespace would be also something useful since we deprecated top level one from ssrContext. Progressively we cwn transit from event.req to event. Right now, event is really a context object only with almost no docs or interface.

Comment threaddocs/content/3.api/1.composables/use-request-event.md Outdated
Comment threaddocs/content/3.api/1.composables/use-request-event.md Outdated
pi0
pi0 approved these changes Jun 9, 2022
@pi0
pi0 merged commit 775a904 into mainJun 9, 2022
@pi0
pi0 deleted the docs/use-req-event branch June 9, 2022 11:07
@pi0pi0 mentioned this pull request Jun 10, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xdocumentationImprovements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: defineNuxtPlugin access old context.req

2 participants

@danielroe@pi0