Skip to content

Commit

Permalink
Update get-api-cookie.ts (#44466)
Browse files Browse the repository at this point in the history
Added the types for req and res.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc]

Here is the documentation followed [Nextjs Link](https://nextjs.org/docs/basic-features/typescript)


Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
dirheimerb and ijjk authored Jan 1, 2023
1 parent fd018fd commit f7b654e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/with-cookies-next/pages/api/get-api-cookie.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { getCookie, getCookies } from 'cookies-next'
import { NextApiRequest, NextApiResponse } from 'next'

export default async function getApiCookie(req, res) {
export default async function getApiCookie(
req: NextApiRequest,
res: NextApiResponse
) {
try {
const currentCookie = getCookie('api-cookie', { req, res })
const allCookies = getCookies({ req, res })
Expand Down

0 comments on commit f7b654e

Please sign in to comment.