kevmodrome
6 years ago
No known key found for this signature in database
GPG Key ID: 828D8FE4D235B551
2 changed files with
15 additions and
12 deletions
-
packages/builder/src/analytics.js
-
packages/builder/src/components/start/CreateAppModal.svelte
|
|
|
@ -39,19 +39,23 @@ function identify(id) { |
|
|
|
|
|
|
|
async function identifyByApiKey(apiKey) { |
|
|
|
if (!analyticsEnabled) return true |
|
|
|
const response = await fetch( |
|
|
|
`https://03gaine137.execute-api.eu-west-1.amazonaws.com/prod/account/id?api_key=${apiKey.trim()}` |
|
|
|
) |
|
|
|
|
|
|
|
if (response.status === 200) { |
|
|
|
const id = await response.json() |
|
|
|
|
|
|
|
await api.put("/api/keys/userId", { value: id }) |
|
|
|
identify(id) |
|
|
|
return true |
|
|
|
try { |
|
|
|
const response = await fetch( |
|
|
|
`https://03gaine137.execute-api.eu-west-1.amazonaws.com/prod/account/id?api_key=${apiKey.trim()}` |
|
|
|
) |
|
|
|
if (response.status === 200) { |
|
|
|
const id = await response.json() |
|
|
|
|
|
|
|
await api.put("/api/keys/userId", { value: id }) |
|
|
|
identify(id) |
|
|
|
return true |
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
} catch (error) { |
|
|
|
console.log(error) |
|
|
|
} |
|
|
|
|
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
function captureException(err) { |
|
|
|
|
|
|
|
@ -27,7 +27,6 @@ |
|
|
|
|
|
|
|
// make sure we only fetch once, unless API Key is changed |
|
|
|
if (isApiKeyValid === undefined || apiKey !== lastApiKey) { |
|
|
|
lastApiKey = apiKey |
|
|
|
// svelte reactivity was causing a requst to get fired mutiple times |
|
|
|
// so, we make everything await the same promise, if one exists |
|
|
|
if (!fetchApiKeyPromise) { |
|
|
|
|