From 424a856baa954875f82fa321ff40fa7a9002b82d Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 3 Oct 2023 10:25:13 +0200 Subject: [PATCH 01/10] Migrated HttpUtils.js lib to TypeScript. --- src/components/Alert/index.js | 2 +- src/libs/{HttpUtils.js => HttpUtils.ts} | 69 ++++++++++++------------- src/types/onyx/Response.ts | 8 +++ 3 files changed, 41 insertions(+), 38 deletions(-) rename src/libs/{HttpUtils.js => HttpUtils.ts} (67%) diff --git a/src/components/Alert/index.js b/src/components/Alert/index.js index dc3a722c2331..3fc90433f13e 100644 --- a/src/components/Alert/index.js +++ b/src/components/Alert/index.js @@ -5,7 +5,7 @@ import _ from 'underscore'; * * @param {String} title The title of the alert * @param {String} description The description of the alert - * @param {Object[]} options An array of objects with `style` and `onPress` properties + * @param {Object[]} [options] An array of objects with `style` and `onPress` properties */ export default (title, description, options) => { const result = _.filter(window.confirm([title, description], Boolean)).join('\n'); diff --git a/src/libs/HttpUtils.js b/src/libs/HttpUtils.ts similarity index 67% rename from src/libs/HttpUtils.js rename to src/libs/HttpUtils.ts index 5a8185a03038..ad902385495f 100644 --- a/src/libs/HttpUtils.js +++ b/src/libs/HttpUtils.ts @@ -1,10 +1,13 @@ import Onyx from 'react-native-onyx'; -import _ from 'underscore'; import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; import HttpsError from './Errors/HttpsError'; import * as ApiUtils from './ApiUtils'; import alert from '../components/Alert'; +import type Response from '../types/onyx/Response'; + +type ProcessHttpRequest = (url: string, method: string, body: FormData | null, canCancel: boolean) => Promise; +type Xhr = (command: string, data: Record, type: string, shouldUseSecure: boolean) => Promise; let shouldFailAllRequests = false; let shouldForceOffline = false; @@ -25,15 +28,9 @@ let cancellationController = new AbortController(); /** * Send an HTTP request, and attempt to resolve the json response. * If there is a network error, we'll set the application offline. - * - * @param {String} url - * @param {String} [method] - * @param {Object} [body] - * @param {Boolean} [canCancel] - * @returns {Promise} */ -function processHTTPRequest(url, method = 'get', body = null, canCancel = true) { - return fetch(url, { +const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null, canCancel = true) => + fetch(url, { // We hook requests to the same Controller signal, so we can cancel them all at once signal: canCancel ? cancellationController.signal : undefined, method, @@ -49,40 +46,40 @@ function processHTTPRequest(url, method = 'get', body = null, canCancel = true) if (!response.ok) { // Expensify site is down or there was an internal server error, or something temporary like a Bad Gateway, or unknown error occurred - const serviceInterruptedStatuses = [ + const serviceInterruptedStatuses: number[] = [ CONST.HTTP_STATUS.INTERNAL_SERVER_ERROR, CONST.HTTP_STATUS.BAD_GATEWAY, CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (_.contains(serviceInterruptedStatuses, response.status)) { + if (serviceInterruptedStatuses.includes(response.status)) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, - status: response.status, + status: response.status.toString(), title: 'Issue connecting to Expensify site', }); } else if (response.status === CONST.HTTP_STATUS.TOO_MANY_REQUESTS) { throw new HttpsError({ message: CONST.ERROR.THROTTLED, - status: response.status, + status: response.status.toString(), title: 'API request throttled', }); } throw new HttpsError({ message: response.statusText, - status: response.status, + status: response.status.toString(), }); } return response.json(); }) - .then((response) => { + .then((response: Response) => { // Some retried requests will result in a "Unique Constraints Violation" error from the server, which just means the record already exists if (response.jsonCode === CONST.JSON_CODE.BAD_REQUEST && response.message === CONST.ERROR_TITLE.DUPLICATE_RECORD) { throw new HttpsError({ message: CONST.ERROR.DUPLICATE_RECORD, - status: CONST.JSON_CODE.BAD_REQUEST, + status: CONST.JSON_CODE.BAD_REQUEST.toString(), title: CONST.ERROR_TITLE.DUPLICATE_RECORD, }); } @@ -91,44 +88,42 @@ function processHTTPRequest(url, method = 'get', body = null, canCancel = true) if (response.jsonCode === CONST.JSON_CODE.EXP_ERROR && response.title === CONST.ERROR_TITLE.SOCKET && response.type === CONST.ERROR_TYPE.SOCKET) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, - status: CONST.JSON_CODE.EXP_ERROR, + status: CONST.JSON_CODE.EXP_ERROR.toString(), title: CONST.ERROR_TITLE.SOCKET, }); } if (response.jsonCode === CONST.JSON_CODE.MANY_WRITES_ERROR) { - const {phpCommandName, authWriteCommands} = response.data; - // eslint-disable-next-line max-len - const message = `The API call (${phpCommandName}) did more Auth write requests than allowed. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( - ', ', - )}. Check the APIWriteCommands class in Web-Expensify`; - alert('Too many auth writes', message); + if (response.data) { + const {phpCommandName, authWriteCommands} = response.data; + // eslint-disable-next-line max-len + const message = `The API call (${phpCommandName}) did more Auth write requests than allowed. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( + ', ', + )}. Check the APIWriteCommands class in Web-Expensify`; + alert('Too many auth writes', message); + } } return response; }); -} /** * Makes XHR request - * @param {String} command the name of the API command - * @param {Object} data parameters for the API command - * @param {String} type HTTP request type (get/post) - * @param {Boolean} shouldUseSecure should we use the secure server - * @returns {Promise} + * @param command the name of the API command + * @param data parameters for the API command + * @param type HTTP request type (get/post) + * @param shouldUseSecure should we use the secure server */ -function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) { +const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) => { const formData = new FormData(); - _.each(data, (val, key) => { - // Do not send undefined request parameters to our API. They will be processed as strings of 'undefined'. - if (_.isUndefined(val)) { + Object.keys(data).forEach((key) => { + if (data[key] === undefined) { return; } - - formData.append(key, val); + formData.append(key, data[key]); }); const url = ApiUtils.getCommandURL({shouldUseSecure, command}); - return processHTTPRequest(url, type, formData, data.canCancel); -} + return processHTTPRequest(url, type, formData, Boolean(data.canCancel)); +}; function cancelPendingRequests() { cancellationController.abort(); diff --git a/src/types/onyx/Response.ts b/src/types/onyx/Response.ts index 255ac6d9bae4..263f1f37d886 100644 --- a/src/types/onyx/Response.ts +++ b/src/types/onyx/Response.ts @@ -1,5 +1,10 @@ import {OnyxUpdate} from 'react-native-onyx'; +type Data = { + phpCommandName: string; + authWriteCommands: string[]; +}; + type Response = { previousUpdateID?: number | string; lastUpdateID?: number | string; @@ -7,6 +12,9 @@ type Response = { onyxData?: OnyxUpdate[]; requestID?: string; message?: string; + title?: string; + data?: Data; + type?: string; }; export default Response; From 1b9523e690ec0208cde6dfe4a976db9ee39a2098 Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 3 Oct 2023 14:14:06 +0200 Subject: [PATCH 02/10] Requested changes. --- src/libs/HttpUtils.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index ad902385495f..5199ee6e6e6e 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -6,11 +6,9 @@ import * as ApiUtils from './ApiUtils'; import alert from '../components/Alert'; import type Response from '../types/onyx/Response'; -type ProcessHttpRequest = (url: string, method: string, body: FormData | null, canCancel: boolean) => Promise; -type Xhr = (command: string, data: Record, type: string, shouldUseSecure: boolean) => Promise; - let shouldFailAllRequests = false; let shouldForceOffline = false; + Onyx.connect({ key: ONYXKEYS.NETWORK, callback: (network) => { @@ -29,8 +27,8 @@ let cancellationController = new AbortController(); * Send an HTTP request, and attempt to resolve the json response. * If there is a network error, we'll set the application offline. */ -const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null, canCancel = true) => - fetch(url, { +function processHTTPRequest(url: string, method = 'get', body: FormData | null = null, canCancel = true): Promise { + return fetch(url, { // We hook requests to the same Controller signal, so we can cancel them all at once signal: canCancel ? cancellationController.signal : undefined, method, @@ -104,6 +102,7 @@ const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null } return response; }); +} /** * Makes XHR request @@ -112,10 +111,10 @@ const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null * @param type HTTP request type (get/post) * @param shouldUseSecure should we use the secure server */ -const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) => { +function xhr(command: string, data: Record, type: string = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { - if (data[key] === undefined) { + if (!data[key]) { return; } formData.append(key, data[key]); @@ -123,7 +122,7 @@ const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecu const url = ApiUtils.getCommandURL({shouldUseSecure, command}); return processHTTPRequest(url, type, formData, Boolean(data.canCancel)); -}; +} function cancelPendingRequests() { cancellationController.abort(); From e263366461f1b5a427bc790531a16b0346411055 Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Thu, 9 Nov 2023 12:42:30 +0100 Subject: [PATCH 03/10] Rebased with main. --- src/libs/HttpUtils.ts | 15 ++++++++------- src/libs/Request.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 0b0f9a46671d..72a5025fa984 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -2,9 +2,9 @@ import Onyx from 'react-native-onyx'; import alert from '@components/Alert'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import type Response from '@src/types/onyx/Response'; import * as ApiUtils from './ApiUtils'; import HttpsError from './Errors/HttpsError'; -import type Response from '@types/onyx/Response'; let shouldFailAllRequests = false; let shouldForceOffline = false; @@ -56,7 +56,8 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = status: response.status.toString(), title: 'Issue connecting to Expensify site', }); - } else if (response.status === CONST.HTTP_STATUS.TOO_MANY_REQUESTS) { + } + if (response.status === CONST.HTTP_STATUS.TOO_MANY_REQUESTS) { throw new HttpsError({ message: CONST.ERROR.THROTTLED, status: response.status.toString(), @@ -70,9 +71,9 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = }); } - return response.json(); + return response.json() as Promise; }) - .then((response: Response) => { + .then((response) => { // Some retried requests will result in a "Unique Constraints Violation" error from the server, which just means the record already exists if (response.jsonCode === CONST.JSON_CODE.BAD_REQUEST && response.message === CONST.ERROR_TITLE.DUPLICATE_RECORD) { throw new HttpsError({ @@ -100,7 +101,7 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = alert('Too many auth writes', message); } } - return response; + return response as Promise; }); } @@ -111,13 +112,13 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = * @param type HTTP request type (get/post) * @param shouldUseSecure should we use the secure server */ -function xhr(command: string, data: Record, type: string = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { +function xhr(command: string, data: Record, type: string = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { if (!data[key]) { return; } - formData.append(key, data[key]); + formData.append(key, data[key] as string | Blob); }); const url = ApiUtils.getCommandURL({shouldUseSecure, command}); diff --git a/src/libs/Request.ts b/src/libs/Request.ts index 335731763ec9..18fadca467ad 100644 --- a/src/libs/Request.ts +++ b/src/libs/Request.ts @@ -16,7 +16,7 @@ function makeXHR(request: Request): Promise { return new Promise((resolve) => resolve()); } - return HttpUtils.xhr(request.command, finalParameters, request.type, request.shouldUseSecure) as Promise; + return HttpUtils.xhr(request.command, finalParameters, request.type, request.shouldUseSecure); }); } From 1aabe03fde2d03abd4f1b360ad3dde48b007234f Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Thu, 9 Nov 2023 13:26:45 +0100 Subject: [PATCH 04/10] Requested changes. --- src/libs/HttpUtils.ts | 7 ++++--- src/types/onyx/Request.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 72a5025fa984..97afbda63ccd 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -1,4 +1,5 @@ import Onyx from 'react-native-onyx'; +import {ValueOf} from 'type-fest'; import alert from '@components/Alert'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -44,13 +45,13 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = if (!response.ok) { // Expensify site is down or there was an internal server error, or something temporary like a Bad Gateway, or unknown error occurred - const serviceInterruptedStatuses: number[] = [ + const serviceInterruptedStatuses: Array> = [ CONST.HTTP_STATUS.INTERNAL_SERVER_ERROR, CONST.HTTP_STATUS.BAD_GATEWAY, CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (serviceInterruptedStatuses.includes(response.status)) { + if (serviceInterruptedStatuses.includes(response.status as ValueOf)) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, status: response.status.toString(), @@ -112,7 +113,7 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = * @param type HTTP request type (get/post) * @param shouldUseSecure should we use the secure server */ -function xhr(command: string, data: Record, type: string = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { +function xhr(command: string, data: Record, type: 'get' | 'post' = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { if (!data[key]) { diff --git a/src/types/onyx/Request.ts b/src/types/onyx/Request.ts index 836138ca99ba..6e9e1960f7fa 100644 --- a/src/types/onyx/Request.ts +++ b/src/types/onyx/Request.ts @@ -11,7 +11,7 @@ type RequestData = { command: string; commandName?: string; data?: Record; - type?: string; + type?: 'get' | 'post'; shouldUseSecure?: boolean; successData?: OnyxUpdate[]; failureData?: OnyxUpdate[]; From d9411394ce506a12f512ec7a4e7fd1608dd31a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Fa=C5=82at?= Date: Thu, 9 Nov 2023 13:32:26 +0100 Subject: [PATCH 05/10] Requested change. Co-authored-by: Jakub Butkiewicz --- src/libs/HttpUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 97afbda63ccd..0b45a6cf3cce 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -51,7 +51,7 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (serviceInterruptedStatuses.includes(response.status as ValueOf)) { + if (serviceInterruptedStatuses.some(status => status === response.status)) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, status: response.status.toString(), From 370f01c33d22e4acacdfaa7bd23c4b698cebf789 Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 14 Nov 2023 12:05:29 +0100 Subject: [PATCH 06/10] Applied requested changes + conflicts. --- src/types/onyx/Request.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/Request.ts b/src/types/onyx/Request.ts index 6e9e1960f7fa..33105b914b6f 100644 --- a/src/types/onyx/Request.ts +++ b/src/types/onyx/Request.ts @@ -7,11 +7,13 @@ type OnyxData = { optimisticData?: OnyxUpdate[]; }; +type RequestType = 'get' | 'post'; + type RequestData = { command: string; commandName?: string; data?: Record; - type?: 'get' | 'post'; + type?: RequestType; shouldUseSecure?: boolean; successData?: OnyxUpdate[]; failureData?: OnyxUpdate[]; @@ -23,4 +25,4 @@ type RequestData = { type Request = RequestData & OnyxData; export default Request; -export type {OnyxData}; +export type {OnyxData, RequestType}; From d939cc2970e2bc9b995f98f009d9df2ce3c2a384 Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 14 Nov 2023 12:12:36 +0100 Subject: [PATCH 07/10] Applied types in rest of places. --- src/libs/HttpUtils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 0b45a6cf3cce..4e5e9d77979a 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -3,6 +3,7 @@ import {ValueOf} from 'type-fest'; import alert from '@components/Alert'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import {RequestType} from '@src/types/onyx/Request'; import type Response from '@src/types/onyx/Response'; import * as ApiUtils from './ApiUtils'; import HttpsError from './Errors/HttpsError'; @@ -28,7 +29,7 @@ let cancellationController = new AbortController(); * Send an HTTP request, and attempt to resolve the json response. * If there is a network error, we'll set the application offline. */ -function processHTTPRequest(url: string, method = 'get', body: FormData | null = null, canCancel = true): Promise { +function processHTTPRequest(url: string, method: RequestType = 'get', body: FormData | null = null, canCancel = true): Promise { return fetch(url, { // We hook requests to the same Controller signal, so we can cancel them all at once signal: canCancel ? cancellationController.signal : undefined, @@ -51,7 +52,7 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (serviceInterruptedStatuses.some(status => status === response.status)) { + if (serviceInterruptedStatuses.some((status) => status === response.status)) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, status: response.status.toString(), @@ -113,7 +114,7 @@ function processHTTPRequest(url: string, method = 'get', body: FormData | null = * @param type HTTP request type (get/post) * @param shouldUseSecure should we use the secure server */ -function xhr(command: string, data: Record, type: 'get' | 'post' = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { +function xhr(command: string, data: Record, type: RequestType = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { if (!data[key]) { From 0d5a1ee2606bccf6b16ddb225c17ab626d0ccbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=27fvlvte=27=20Fa=C5=82at?= Date: Tue, 21 Nov 2023 21:14:18 +0100 Subject: [PATCH 08/10] Requested changes. --- src/libs/HttpUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 4e5e9d77979a..911069691896 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -52,7 +52,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (serviceInterruptedStatuses.some((status) => status === response.status)) { + if (serviceInterruptedStatuses.indexOf(response.status) > -1) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, status: response.status.toString(), @@ -117,7 +117,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form function xhr(command: string, data: Record, type: RequestType = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { - if (!data[key]) { + if (typeof data[key] === "undefined") { return; } formData.append(key, data[key] as string | Blob); From 713a12c8db20040d7b0e65d6e4fbdea7804dbb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=27fvlvte=27=20Fa=C5=82at?= Date: Tue, 21 Nov 2023 21:21:03 +0100 Subject: [PATCH 09/10] Added type cast to value. --- src/libs/HttpUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 911069691896..0b798205366c 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -52,7 +52,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (serviceInterruptedStatuses.indexOf(response.status) > -1) { + if (serviceInterruptedStatuses.indexOf(response.status as ValueOf) > -1) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, status: response.status.toString(), From 9e0efac9ed7af1e639bf13b88df57fed334fad7d Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 21 Nov 2023 21:30:23 +0100 Subject: [PATCH 10/10] Prettier applied. --- src/libs/HttpUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 0b798205366c..859c8624833c 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -117,7 +117,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form function xhr(command: string, data: Record, type: RequestType = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { - if (typeof data[key] === "undefined") { + if (typeof data[key] === 'undefined') { return; } formData.append(key, data[key] as string | Blob);