diff --git a/.gitignore b/.gitignore index 5cfd9b2ee5..66c9b38891 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ node_modules /node_modules # Build Dist -/build/dist +*/build/dist/* .idea # testing diff --git a/accounts/src/api.ts b/accounts/src/api.ts index e599380424..a86baa7908 100755 --- a/accounts/src/api.ts +++ b/accounts/src/api.ts @@ -23,10 +23,10 @@ export function postApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { User.clear(); history.push('/login'); @@ -50,10 +50,10 @@ export function getApi(url: $TSFixMe) { url: `${baseURL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { User.clear(); history.push('/login'); @@ -79,10 +79,10 @@ export function putApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { User.clear(); history.push('/login'); @@ -108,10 +108,10 @@ export function deleteApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { User.clear(); history.push('/login'); diff --git a/accounts/src/serviceWorker.ts b/accounts/src/serviceWorker.ts index 690aacc1cd..56fa9ee08e 100644 --- a/accounts/src/serviceWorker.ts +++ b/accounts/src/serviceWorker.ts @@ -12,12 +12,12 @@ const isLocalhost = Boolean( window.location.hostname === 'localhost' || - // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || - // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) + // [::1] is the IPv6 localhost address. + window.location.hostname === '[::1]' || + // 127.0.0.1/8 is considered localhost for IPv4. + window.location.hostname.match( + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ + ) ); export function register(config: $TSFixMe) { @@ -48,7 +48,7 @@ export function register(config: $TSFixMe) { window.addEventListener('fetch', event => { event.respondWith( - caches.match(event.request).then(function (response) { + caches.match(event.request).then((response) => { // Cache hit - return response if (response) { return response; diff --git a/admin-dashboard/src/api.ts b/admin-dashboard/src/api.ts index e3b6931584..35d31700a9 100644 --- a/admin-dashboard/src/api.ts +++ b/admin-dashboard/src/api.ts @@ -31,10 +31,10 @@ export function postApi(url: $TSFixMe, data: $TSFixMe, licensing: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -62,10 +62,10 @@ export function getApi(url: $TSFixMe, licensing: $TSFixMe) { url: `${licensing ? licensingURL : baseURL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -95,10 +95,10 @@ export function putApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -128,10 +128,10 @@ export function deleteApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -160,10 +160,10 @@ export function getApiDocs(url: $TSFixMe) { url: `${API_DOCS_URL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -192,10 +192,10 @@ export function getApiHelm(url: $TSFixMe) { url: `${HELM_CHART_URL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -224,10 +224,10 @@ export function getApiDashboard(url: $TSFixMe) { url: `${DASHBOARD_URL}/api/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); diff --git a/application-scanner/utils/api.ts b/application-scanner/utils/api.ts index 74198e8a7b..3aad296984 100755 --- a/application-scanner/utils/api.ts +++ b/application-scanner/utils/api.ts @@ -23,10 +23,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -45,10 +45,10 @@ const _this = { url: `${config.serverUrl}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -68,10 +68,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -91,10 +91,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/container-scanner/utils/api.ts b/container-scanner/utils/api.ts index d2f817188a..9ca2b12ad8 100755 --- a/container-scanner/utils/api.ts +++ b/container-scanner/utils/api.ts @@ -23,10 +23,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -45,10 +45,10 @@ const _this = { url: `${config.serverUrl}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -68,10 +68,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -91,10 +91,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/dashboard/src/api.ts b/dashboard/src/api.ts index 5c5a321f10..6a81bebe95 100755 --- a/dashboard/src/api.ts +++ b/dashboard/src/api.ts @@ -23,10 +23,10 @@ export function postApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -58,10 +58,10 @@ export function getApi(url: $TSFixMe) { url: `${baseURL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -95,10 +95,10 @@ export function putApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); @@ -132,10 +132,10 @@ export function deleteApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { deffered.resolve(response); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.status === 401) { const cookies = new Cookies(); cookies.remove('admin-data', { path: '/' }); diff --git a/data-ingestor/utils/api.ts b/data-ingestor/utils/api.ts index 38338d513a..f1bacf5c98 100755 --- a/data-ingestor/utils/api.ts +++ b/data-ingestor/utils/api.ts @@ -26,10 +26,10 @@ const _this = { maxContentLength: Infinity, maxBodyLength: Infinity, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -48,10 +48,10 @@ const _this = { url: withBaseUrl ? `${url}` : `${serverUrl}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -75,10 +75,10 @@ const _this = { maxContentLength: Infinity, maxBodyLength: Infinity, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -98,10 +98,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/init-script/util/api.ts b/init-script/util/api.ts index 65df3cf392..6df5687ad2 100755 --- a/init-script/util/api.ts +++ b/init-script/util/api.ts @@ -20,10 +20,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/lighthouse-runner/utils/api.ts b/lighthouse-runner/utils/api.ts index 342c19e4dd..4f27efeed5 100755 --- a/lighthouse-runner/utils/api.ts +++ b/lighthouse-runner/utils/api.ts @@ -20,10 +20,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -42,10 +42,10 @@ const _this = { url: `${config.serverUrl}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -65,10 +65,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -88,10 +88,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/probe-api/utils/api.ts b/probe-api/utils/api.ts index bf24ad55d3..662beeb048 100755 --- a/probe-api/utils/api.ts +++ b/probe-api/utils/api.ts @@ -25,10 +25,10 @@ const _this = { maxContentLength: Infinity, maxBodyLength: Infinity, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/probe/utils/api.ts b/probe/utils/api.ts index 459e79a9b0..411de78215 100755 --- a/probe/utils/api.ts +++ b/probe/utils/api.ts @@ -29,10 +29,10 @@ const _this = { maxContentLength: Infinity, maxBodyLength: Infinity, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -51,10 +51,10 @@ const _this = { url: `${config.probeApiUrl}/${url}?limit=${limit}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -79,10 +79,10 @@ const _this = { maxContentLength: Infinity, maxBodyLength: Infinity, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -102,10 +102,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/script-runner/utils/api.ts b/script-runner/utils/api.ts index 342c19e4dd..4f27efeed5 100755 --- a/script-runner/utils/api.ts +++ b/script-runner/utils/api.ts @@ -20,10 +20,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -42,10 +42,10 @@ const _this = { url: `${config.serverUrl}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -65,10 +65,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { @@ -88,10 +88,10 @@ const _this = { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response.data); }) - .catch(function (error) { + .then((error) => { if (error && error.response && error.response.data) error = error.response.data; if (error && error.data) { diff --git a/status-page/src/api.ts b/status-page/src/api.ts index b29773113e..fe717dfaed 100755 --- a/status-page/src/api.ts +++ b/status-page/src/api.ts @@ -19,10 +19,10 @@ export function postApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response); }) - .catch(function (error) { + .then((error) => { reject(error); }); }); @@ -40,10 +40,10 @@ export function getApi(url: $TSFixMe) { url: `${API_URL}/${url}`, headers, }) - .then(function (response) { + .then((response) => { resolve(response); }) - .catch(function (error) { + .then((error) => { reject(error); }); }); @@ -62,10 +62,10 @@ export function putApi(url: $TSFixMe, data: $TSFixMe) { headers, data, }) - .then(function (response) { + .then((response) => { resolve(response); }) - .catch(function (error) { + .then((error) => { reject(error); }); });