From ca33332a3833e8edb6d55bb674e8583ed4345354 Mon Sep 17 00:00:00 2001 From: sjkadali <39105848+sjkadali@users.noreply.github.com> Date: Sat, 2 Apr 2022 05:58:11 -0400 Subject: [PATCH] chore(challenges-utils): Typescript migration of Challenges util postUpdate$.js (#45601) * Rename to .ts * Typescript migration of Challenges/utils/postUpdate$.js --- client/src/redux/failed-updates-epic.js | 2 +- .../templates/Challenges/redux/completion-epic.js | 2 +- .../src/templates/Challenges/utils/post-update.ts | 14 ++++++++++++++ .../src/templates/Challenges/utils/postUpdate$.js | 6 ------ 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 client/src/templates/Challenges/utils/post-update.ts delete mode 100644 client/src/templates/Challenges/utils/postUpdate$.js diff --git a/client/src/redux/failed-updates-epic.js b/client/src/redux/failed-updates-epic.js index 30f2219ae4..7d008cb475 100644 --- a/client/src/redux/failed-updates-epic.js +++ b/client/src/redux/failed-updates-epic.js @@ -13,7 +13,7 @@ import { v4 as uuid } from 'uuid'; import { backEndProject } from '../../utils/challenge-types'; import { isGoodXHRStatus } from '../templates/Challenges/utils'; -import postUpdate$ from '../templates/Challenges/utils/postUpdate$'; +import postUpdate$ from '../templates/Challenges/utils/post-update'; import { actionTypes } from './action-types'; import { serverStatusChange, diff --git a/client/src/templates/Challenges/redux/completion-epic.js b/client/src/templates/Challenges/redux/completion-epic.js index 073296b2ba..3034a278ba 100644 --- a/client/src/templates/Challenges/redux/completion-epic.js +++ b/client/src/templates/Challenges/redux/completion-epic.js @@ -20,7 +20,7 @@ import { updateFailed } from '../../../redux'; -import postUpdate$ from '../utils/postUpdate$'; +import postUpdate$ from '../utils/post-update'; import { mapFilesToChallengeFiles } from '../../../utils/ajax'; import { standardizeRequestBody } from '../../../utils/challenge-request-helpers'; import { actionTypes } from './action-types'; diff --git a/client/src/templates/Challenges/utils/post-update.ts b/client/src/templates/Challenges/utils/post-update.ts new file mode 100644 index 0000000000..e588bbe73d --- /dev/null +++ b/client/src/templates/Challenges/utils/post-update.ts @@ -0,0 +1,14 @@ +import { from, Observable } from 'rxjs'; +import { post } from '../../../utils/ajax'; + +interface PostData { + endpoint: string; + payload: unknown; +} + +export default function postUpdate$({ + endpoint, + payload +}: PostData): Observable { + return from(post(endpoint, payload)); +} diff --git a/client/src/templates/Challenges/utils/postUpdate$.js b/client/src/templates/Challenges/utils/postUpdate$.js deleted file mode 100644 index e3199f85d2..0000000000 --- a/client/src/templates/Challenges/utils/postUpdate$.js +++ /dev/null @@ -1,6 +0,0 @@ -import { from } from 'rxjs'; -import { post } from '../../../utils/ajax'; - -export default function postUpdate$({ endpoint, payload }) { - return from(post(endpoint, payload)); -}