Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ committed Sep 10, 2024
1 parent da8709a commit 0d52409
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ClientConfig {
/**
* Specify your own http client. Default uses axios
* Specify your own http client. Default uses fetch
*/
httpClient?: HttpClient;
/**
Expand Down
35 changes: 1 addition & 34 deletions website/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Distribution Hash. See the [Content Delivery](https://support.crowdin.com/conten

Custom HTTP client.

Default: [Axios](https://www.npmjs.com/package/axios) HTTP client
Default: [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) HTTP client

### `languageCode`

Expand Down Expand Up @@ -68,39 +68,6 @@ Disable deep merge of json-based files for string-based methods and use shallow

Default: `false`

## Axios error

There might be an issue with axios dependency when using webpack 5 or babel build tools (e.g. [React Scripts 5+](https://create-react-app.dev) or [Expo](https://react.dev/learn/start-a-new-react-project#expo)).

In case if you got following error:

```
ERROR
Cannot read properties of undefined (reading 'create')
TypeError: Cannot read properties of undefined (reading 'create')
```

You will have to manually install [axios 1.6.0](https://github.com/axios/axios)

```bash
npm i axios
```

And pass it in OTA Client config

```typescript
import otaClient from '@crowdin/ota-client';

const client = new otaClient(hash, {
httpClient: {
get: async (url) => {
const res = await axios.get(url);
return res.data;
}
}
});
```

## Further reading

- [API](/api/classes/OtaClient)

0 comments on commit 0d52409

Please sign in to comment.