Skip to content

Commit

Permalink
log and key fallback added if not prod (#9)
Browse files Browse the repository at this point in the history
* log and key fallback added if not prod

* updated logic

* updated logic

* urgent fix

* urgent fix

* updated version
  • Loading branch information
ali-718 authored Jun 15, 2022
1 parent 1e2d1dd commit 999f3ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion example/src/modules/ImageCrush.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ const ImageCrush = ({
const imageUrl = `${baseServiceUrl}?width=${_width}&height=${_height}&original_uri=${encodeURIComponent(
url
)}`;
const key = getKey();
const key = getKey() ? getKey() : process.env.NODE_ENV === "development" ? 'test-key' : '';
let headers = {};

if (process.env.NODE_ENV === "development" && !getKey()) {
console.log(' Key is not present, please go to console.assetcrush.com and sign up to get one.')
}

fetch(imageUrl, { headers: { "assetcrush-key": key, "ac-env": acEnv, ...headers } })
.then((r) => {
headers = r.headers;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@assetcrush/reactjs-sdk",
"version": "0.1.4",
"version": "0.1.5",
"description": "A simple reactjs library to resize image on fly",
"main": "dist/index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 999f3ae

Please sign in to comment.