API do Next.js
@byeolnaerim/typed-rx-http/next é o ponto de entrada.
callApiSsrCache(options)
| Name | Type | Default | Descrição |
|---|---|---|---|
baseUrl obrigatório | string | - | 서버 fetch base URL. |
serviceArguments obrigatório | ServiceArguments<Paths, ...> | - | URL, method, path/query/body와 parser. |
cacheForService obrigatório | CacheForService<CacheName> | - | cacheName과 millisecond cacheTime. |
headersProvider | () => headers | Promise<headers> | - | cookie 기반 Authorization 등 서버 요청별 헤더. |
onServer401 | () => void | Promise<void> | - | 401 처리 hook. |
ts
GET + cacheTime > 0 se unstable_cacheimportar dinamicamenteforce-cache, usando revalidate e tag cacheName. O restante é no-store.
redirectToUnauthorizedOnServer401()
ts
| Name | Type | Default | Descrição |
|---|---|---|---|
page source | x-page-url request header | / | redirect_uri에 넣을 현재 페이지. |
destination | string | /unauthorized | 고정 redirect path. |
query | redirect_uri + logout | logout=true | 고정 query 규칙. |