File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed
Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @yme/api" ,
3- "description" : " Simply create some standalone functions" ,
3+ "description" : " Simply create some request functions" ,
44 "version" : " 0.0.0-development" ,
55 "type" : " module" ,
66 "sideEffects" : false ,
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ npm install @yme/api
3030Use ` ApiClient ` with ` fetch ` (Action first)
3131
3232``` ts
33- import { ApiClient , replacePathParams } from " @yme/api/client" ;
33+ import { createClient , replacePathParams } from " @yme/api/client" ;
3434import { logger } from " @yme/api/middleware" ;
3535
36- const api = new ApiClient ({
36+ const api = createClient ({
3737 action : async ({ req }) => {
3838 // make http request and return data
3939 const response = await fetch (req .url , {
@@ -80,8 +80,8 @@ const newUserId = await createUser(
8080Use ` NextAction ` for Next.js server action (Action last)
8181
8282``` ts
83- import { NextAction } from " @yme/api/next" ;
84- const api = new NextAction ({
83+ import { createAction } from " @yme/api/next" ;
84+ const api = createAction ({
8585 middlewares: [],
8686 // throwing an error will make the server return status 500
8787 // we can handle it in the error handler. e.g. returns a fallback data with error message
Original file line number Diff line number Diff line change @@ -30,10 +30,10 @@ npm install @yme/api
3030Use ` ApiClient ` with ` fetch ` (Action first)
3131
3232``` ts
33- import { ApiClient , replacePathParams } from " @yme/api/client" ;
33+ import { createClient , replacePathParams } from " @yme/api/client" ;
3434import { logger } from " @yme/api/middleware" ;
3535
36- const api = new ApiClient ({
36+ const api = createClient ({
3737 action : async ({ req }) => {
3838 // make http request and return data
3939 const response = await fetch (req .url , {
@@ -80,8 +80,8 @@ const newUserId = await createUser(
8080Use ` NextAction ` for Next.js server action (Action last)
8181
8282``` ts
83- import { NextAction } from " @yme/api/next" ;
84- const api = new NextAction ({
83+ import { createAction } from " @yme/api/next" ;
84+ const api = createAction ({
8585 middlewares: [],
8686 // throwing an error will make the server return status 500
8787 // we can handle it in the error handler. e.g. returns a fallback data with error message
You can’t perform that action at this time.
0 commit comments