chore(challenges-utils): Typescript migration of Challenges util postUpdate$.js (#45601)
* Rename to .ts * Typescript migration of Challenges/utils/postUpdate$.js
This commit is contained in:
@@ -13,7 +13,7 @@ import { v4 as uuid } from 'uuid';
|
|||||||
|
|
||||||
import { backEndProject } from '../../utils/challenge-types';
|
import { backEndProject } from '../../utils/challenge-types';
|
||||||
import { isGoodXHRStatus } from '../templates/Challenges/utils';
|
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 { actionTypes } from './action-types';
|
||||||
import {
|
import {
|
||||||
serverStatusChange,
|
serverStatusChange,
|
||||||
|
@@ -20,7 +20,7 @@ import {
|
|||||||
updateFailed
|
updateFailed
|
||||||
} from '../../../redux';
|
} from '../../../redux';
|
||||||
|
|
||||||
import postUpdate$ from '../utils/postUpdate$';
|
import postUpdate$ from '../utils/post-update';
|
||||||
import { mapFilesToChallengeFiles } from '../../../utils/ajax';
|
import { mapFilesToChallengeFiles } from '../../../utils/ajax';
|
||||||
import { standardizeRequestBody } from '../../../utils/challenge-request-helpers';
|
import { standardizeRequestBody } from '../../../utils/challenge-request-helpers';
|
||||||
import { actionTypes } from './action-types';
|
import { actionTypes } from './action-types';
|
||||||
|
14
client/src/templates/Challenges/utils/post-update.ts
Normal file
14
client/src/templates/Challenges/utils/post-update.ts
Normal file
@@ -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<void> {
|
||||||
|
return from(post(endpoint, payload));
|
||||||
|
}
|
@@ -1,6 +0,0 @@
|
|||||||
import { from } from 'rxjs';
|
|
||||||
import { post } from '../../../utils/ajax';
|
|
||||||
|
|
||||||
export default function postUpdate$({ endpoint, payload }) {
|
|
||||||
return from(post(endpoint, payload));
|
|
||||||
}
|
|
Reference in New Issue
Block a user