Skip to content

Commit 25b86b0

Browse files
authored
Update README.md
1 parent e7d950e commit 25b86b0

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

README.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ ImageKit Vue.js SDK allows you to use real-time [image resizing](https://docs.im
1212
## Breaking changes - Upgrading from 1.x to 2.x version
1313
2.x version has breaking changes as listed below.
1414

15-
* In version 2.0.0, three global components, namely `ik-image`, `ik-upload`, and `ik-context`, are no longer supported. Instead, it is recommended to import these components individually.
16-
17-
```javascript
18-
19-
import { IKImage, IKContext, IKUpload } from "imagekitio-vue"
20-
21-
export default {
22-
components: {
23-
IKImage,
24-
IKContext,
25-
IKUpload
26-
}
27-
}
28-
29-
```
30-
31-
* In version 2.0.0, we have deprecated the use of the `authenticationEndpoint` parameter. Instead, the SDK has introduced a new parameter named `authenticator`. This parameter expects an asynchronous function that resolves with an object containing the necessary security parameters i.e `signature`, `token`, and `expire`.
32-
33-
An example implementation for `authenticator` using `Fetch API`.
34-
35-
``` javascript
36-
37-
const authenticator = async () => {
38-
try {
39-
40-
// You can also pass headers and validate the request source in the backend, or you can use headers for any other use case.
41-
const headers = {
42-
'CustomHeader': 'CustomValue'
43-
};
44-
45-
const response = await fetch('server_endpoint', {
46-
headers
47-
});
48-
49-
if (!response.ok) {
50-
const errorText = await response.text();
51-
throw new Error(`Request failed with status ${response.status}: ${errorText}`);
15+
1. In version 2.0.0, three global components, namely `ik-image`, `ik-upload`, and `ik-context`, are no longer supported. Instead, it is recommended to import these components individually.
16+
17+
```javascript
18+
19+
import { IKImage, IKContext, IKUpload } from "imagekitio-vue"
20+
21+
export default {
22+
components: {
23+
IKImage,
24+
IKContext,
25+
IKUpload
5226
}
53-
54-
const data = await response.json();
55-
const { signature, expire, token } = data;
56-
return { signature, expire, token };
57-
} catch (error) {
58-
throw new Error(`Authentication request failed: ${error.message}`);
59-
}
60-
};
61-
```
27+
}
28+
29+
```
30+
31+
2. We have deprecated the use of the `authenticationEndpoint` parameter. Instead, the SDK has introduced a new parameter named `authenticator`. This parameter expects an asynchronous function that resolves with an object containing the necessary security parameters i.e `signature`, `token`, and `expire`.
32+
33+
An example implementation for `authenticator` using `Fetch API`.
34+
35+
``` javascript
36+
37+
const authenticator = async () => {
38+
try {
39+
40+
// You can also pass headers and validate the request source in the backend, or you can use headers for any other use case.
41+
const headers = {
42+
'CustomHeader': 'CustomValue'
43+
};
44+
45+
const response = await fetch('server_endpoint', {
46+
headers
47+
});
48+
49+
if (!response.ok) {
50+
const errorText = await response.text();
51+
throw new Error(`Request failed with status ${response.status}: ${errorText}`);
52+
}
53+
54+
const data = await response.json();
55+
const { signature, expire, token } = data;
56+
return { signature, expire, token };
57+
} catch (error) {
58+
throw new Error(`Authentication request failed: ${error.message}`);
59+
}
60+
};
61+
```
6262

6363
*Note*: Avoid generating security parameters on the client side. Always send a request to your backend to retrieve security parameters, as the generation of these parameters necessitates the use of your Imagekit `privateKey`, which must not be included in client-side code.
6464

0 commit comments

Comments
 (0)