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

Refactor browser APIs #716

Merged
merged 16 commits into from
May 5, 2024
16 changes: 16 additions & 0 deletions .changeset/silver-bananas-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@quilted/react-query': patch
'@quilted/react-localize': patch
'@quilted/react-browser': patch
'@quilted/react-router': patch
'@quilted/react-async': patch
'@quilted/react-email': patch
'@quilted/react-dom': patch
'@quilted/browser': patch
'@quilted/graphql': patch
'@quilted/assets': patch
'@quilted/create': patch
'@quilted/quilt': patch
---

Refactor browser APIs
21 changes: 1 addition & 20 deletions documentation/features/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function NotFoundUi() {
}
```

## Reading cookies and other request headers
## Reading cookies

You can read cookies using the `useCookie` hook:

Expand All @@ -139,25 +139,6 @@ export function GuardWithAuth({children}: PropsWithChildren) {

On the server, these cookies are parsed from the `Cookie` request header. On the client, these cookies are parsed from `document.cookie`.

If you want to read other request headers, you can use the `useRequestHeader` hook:

```tsx
import {useRequestHeader} from '@quilted/quilt/http';

export function CheckForBrotli() {
// Don’t worry, headers are normalized, so any capitalization works!
const acceptEncoding = useRequestHeader('Accept-Encoding') ?? '';

return acceptEncoding.includes('br') ? (
<div>Request supports brotli!</div>
) : (
<div>Request does not support brotli :(</div>
);
}
```

Typically, request headers are only available on the server-side. When you read them using the `useRequestHeader` hooks, though, they are serialized into the HTML document so that they are also available on the client. **Make sure that you are comfortable exposing this header to the client before using the `useRequestHeader` hook.**

## Setting cookies and other response headers

You can set an HTTP cookie by using the `useResponseCookie` hook or `ResponseCookie` component. Both accept the cookie name, value, and [other cookie options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies).
Expand Down
92 changes: 0 additions & 92 deletions integrations/apollo/CHANGELOG.md

This file was deleted.

86 changes: 0 additions & 86 deletions integrations/apollo/README.md

This file was deleted.

74 changes: 0 additions & 74 deletions integrations/apollo/package.json

This file was deleted.

44 changes: 0 additions & 44 deletions integrations/apollo/source/ApolloProvider.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions integrations/apollo/source/client.ts

This file was deleted.

1 change: 0 additions & 1 deletion integrations/apollo/source/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions integrations/apollo/source/parse.ts

This file was deleted.

Loading
Loading