Skip to content

Commit 999f3ae

Browse files
authored
log and key fallback added if not prod (#9)
* log and key fallback added if not prod * updated logic * updated logic * urgent fix * urgent fix * updated version
1 parent 1e2d1dd commit 999f3ae

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

example/src/modules/ImageCrush.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ const ImageCrush = ({
4242
const imageUrl = `${baseServiceUrl}?width=${_width}&height=${_height}&original_uri=${encodeURIComponent(
4343
url
4444
)}`;
45-
const key = getKey();
45+
const key = getKey() ? getKey() : process.env.NODE_ENV === "development" ? 'test-key' : '';
4646
let headers = {};
4747

48+
if (process.env.NODE_ENV === "development" && !getKey()) {
49+
console.log(' Key is not present, please go to console.assetcrush.com and sign up to get one.')
50+
}
51+
4852
fetch(imageUrl, { headers: { "assetcrush-key": key, "ac-env": acEnv, ...headers } })
4953
.then((r) => {
5054
headers = r.headers;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@assetcrush/reactjs-sdk",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "A simple reactjs library to resize image on fly",
55
"main": "dist/index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)