File tree Expand file tree Collapse file tree 1 file changed +35
-14
lines changed
Expand file tree Collapse file tree 1 file changed +35
-14
lines changed Original file line number Diff line number Diff line change @@ -279,20 +279,7 @@ client.update<Content>({
279279})
280280` ` `
281281
282- ## Tips
283-
284- ### Separate API keys for read and write
285-
286- ` ` ` javascript
287- const readClient = createClient ({
288- serviceDomain: ' serviceDomain' ,
289- apiKey: ' readApiKey' ,
290- })
291- const writeClient = createClient ({
292- serviceDomain: ' serviceDomain' ,
293- apiKey: ' writeApiKey' ,
294- })
295- ` ` `
282+ ## CustomRequestInit
296283
297284### Next.js App Router
298285
@@ -312,6 +299,40 @@ const response = await client.getList({
312299});
313300` ` `
314301
302+ ### AbortController: abort() method
303+
304+ You can abort fetch requests.
305+
306+ ` ` ` ts
307+ const controller = new AbortController ()
308+ const response = await client .getObject ({
309+ customRequestInit: {
310+ signal: controller .signal
311+ },
312+ endpoint: " config" ,
313+ });
314+
315+ setTimeout (() => {
316+ controller .abort ()
317+ }, 1000 )
318+ ` ` `
319+
320+ ## Tips
321+
322+ ### Separate API keys for read and write
323+
324+ ` ` ` javascript
325+ const readClient = createClient ({
326+ serviceDomain: ' serviceDomain' ,
327+ apiKey: ' readApiKey' ,
328+ })
329+ const writeClient = createClient ({
330+ serviceDomain: ' serviceDomain' ,
331+ apiKey: ' writeApiKey' ,
332+ })
333+ ` ` `
334+
335+
315336# LICENSE
316337
317338Apache-2.0
You can’t perform that action at this time.
0 commit comments