@@ -83,9 +83,9 @@ pnpm add @strapi/sdk-js
83
83
To interact with your Strapi backend, initialize the SDK with your Strapi API base URL:
84
84
85
85
``` typescript
86
- import { createStrapiSDK } from ' @strapi/sdk-js' ;
86
+ import { strapiSDK } from ' @strapi/sdk-js' ;
87
87
88
- const sdk = createStrapiSDK ({ baseURL: ' http://localhost:1337/api' });
88
+ const sdk = strapiSDK ({ baseURL: ' http://localhost:1337/api' });
89
89
```
90
90
91
91
Alternatively, use a ` <script> ` tag in a browser environment:
@@ -94,7 +94,7 @@ Alternatively, use a `<script>` tag in a browser environment:
94
94
<script src =" https://cdn.jsdelivr.net/npm/@strapi/sdk-js" ></script >
95
95
96
96
<script >
97
- const sdk = createStrapiSDK ({ baseURL: ' http://localhost:1337/api' });
97
+ const sdk = strapiSDK ({ baseURL: ' http://localhost:1337/api' });
98
98
</script >
99
99
```
100
100
@@ -107,7 +107,7 @@ The SDK supports multiple authentication strategies for accessing authenticated
107
107
If your Strapi instance uses API tokens, configure the SDK like this:
108
108
109
109
``` typescript
110
- const sdk = createStrapiSDK ({
110
+ const sdk = strapiSDK ({
111
111
baseURL: ' http://localhost:1337/api' ,
112
112
auth: {
113
113
strategy: ' api-token' ,
@@ -184,10 +184,10 @@ The `.single()` method provides a manager for working with single-type resources
184
184
const homepage = sdk .single (' homepage' );
185
185
186
186
// Fetch the default version of the homepage
187
- const homepageContent = await homepage .find ();
187
+ const defaultHomepage = await homepage .find ();
188
188
189
189
// Fetch the spanish version of the homepage
190
- const homepageContent = await homepage .find ({ locale: ' es' });
190
+ const spanishHomepage = await homepage .find ({ locale: ' es' });
191
191
192
192
// Update the homepage draft content
193
193
const updatedHomepage = await homepage .update (
@@ -204,7 +204,7 @@ await homepage.delete();
204
204
Here’s how to combine ` .collection() ` and ` .single() ` methods in a real-world scenario:
205
205
206
206
``` typescript
207
- const sdk = createStrapiSDK ({
207
+ const sdk = strapiSDK ({
208
208
baseURL: ' http://localhost:1337/api' ,
209
209
auth: {
210
210
strategy: ' api-token' ,
0 commit comments