mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: add env
Prevent error reporting in dev enviroment
This commit is contained in:
parent
2f2a9f8e95
commit
254e916445
4 changed files with 10 additions and 1 deletions
|
|
@ -24,6 +24,7 @@
|
|||
"devDependencies": {
|
||||
"@types/chrome": "^0.0.77",
|
||||
"@types/ini": "^1.3.30",
|
||||
"@types/node": "^11.9.4",
|
||||
"@types/nprogress": "^0.0.29",
|
||||
"@types/react": "^16.8.2",
|
||||
"@types/react-dom": "^16.8.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { version } from '../package.json'
|
||||
import { Middleware, Method } from 'driver/connect.js'
|
||||
import { Middleware } from 'driver/connect.js'
|
||||
import { IN_PRODUCTION_MODE } from 'env'
|
||||
// TODO: set this through ENV or something else
|
||||
const LOG_ENDPOINT = 'https://enix.one/gitako/log'
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ function encodeParams(params: object) {
|
|||
}
|
||||
|
||||
function reportError(error: Error) {
|
||||
if (!IN_PRODUCTION_MODE) return
|
||||
return fetch(
|
||||
`${LOG_ENDPOINT}?${encodeParams({
|
||||
error: (error && error.message) || error,
|
||||
|
|
|
|||
1
src/env.ts
Normal file
1
src/env.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
|
||||
|
|
@ -767,6 +767,11 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/ini/-/ini-1.3.30.tgz#d1485459c9fad84e937414b832a2adb649eab379"
|
||||
integrity sha512-2+iF8zPSbpU83UKE+PNd4r/MhwNAdyGpk3H+VMgEH3EhjFZq1kouLgRoZrmIcmoGX97xFvqdS44DkICR5Nz3tQ==
|
||||
|
||||
"@types/node@^11.9.4":
|
||||
version "11.9.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.9.4.tgz#ceb0048a546db453f6248f2d1d95e937a6f00a14"
|
||||
integrity sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA==
|
||||
|
||||
"@types/nprogress@^0.0.29":
|
||||
version "0.0.29"
|
||||
resolved "https://registry.yarnpkg.com/@types/nprogress/-/nprogress-0.0.29.tgz#060bd510022a005f1840234030d3132fb9195471"
|
||||
|
|
|
|||
Loading…
Reference in a new issue