- merged with develop;

This commit is contained in:
Vitalii Kiiko
2024-12-11 09:16:12 +01:00
3 changed files with 35 additions and 37 deletions

View File

@@ -1,34 +1,11 @@
import { storeGet, storeSet } from '../store';
import * as Sentry from '@sentry/browser';
const LOCAL_DEVELOPMENT = process.env.REACT_APP_LOCAL_DEVELOPMENT;
import logMsgWithSentry from '../helpers/logMsgWithSentry';
export class NetworkService {
static TOKEN_KEY
static REFRESH_TOKEN_KEY
static logApiError = (endpoint, status = 0, resp = {}) => {
if (status === 500) {
console.log('status:', status, LOCAL_DEVELOPMENT);
if (LOCAL_DEVELOPMENT !== '1') {
try {
Sentry.init({
dsn: 'https://e7b2134f7d816f663bb83e51b106a694@o4508381921738752.ingest.de.sentry.io/4508381935501392',
environment: process.env.NODE_ENV || 'development'
});
const error = new Error(`Status ${status}`);
Sentry.captureException(`Error in endpoint: ${endpoint}`, {
level: 'error',
extra: {
originalError: error,
details: resp
}
});
} catch (err) {
console.log(err);
}
}
logMsgWithSentry(endpoint, status, resp);
} else if (status === 403) {
storeSet.main.token('');
const { pathname } = window.location;