Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to work in browser in angular #61

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agility/content-fetch",
"version": "1.0.1",
"version": "1.0.2",
"description": "JavaScript library for the Agility Fetch API (node and browser)",
"main": "dist/agility-content-fetch.node.js",
"scripts": {
Expand Down
23 changes: 16 additions & 7 deletions src/api-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,22 @@ export default function createClient(userConfig) {

const https= require("https")

//create apply the adapter to our axios instance
const api = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
}),
adapter: adapter,
})
let api = null;

if (https.Agent) {
//create apply the adapter to our axios instance
api = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
}),
adapter: adapter,
})
} else {
//we can't use the https.Agent
api = axios.create({
adapter: adapter,
})
}



Expand Down