Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
fix(sdk): check apiKey quota by origin with or without http
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaWang committed Feb 20, 2020
1 parent 8e5e767 commit f7128b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/extension/src/client/utils/getApiKeyQuota.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ export default async function getApiKeyQuota(apiKey) {
mode: 'cors',
cache: 'no-cache',
});
const currentOrigin = window.location.host;

const {
data: {
quota,
origin,
},
} = await result.json();
const currentOrigin = origin.startsWith('http')
? window.location.origin
: window.location.host;
if (currentOrigin === origin) {
hasFreeTransactions = quota > 0;
}
Expand Down

0 comments on commit f7128b0

Please sign in to comment.