Skip to content

Commit 99d378b

Browse files
author
Huan Li
committed
Remove V2 API from Dashboard and Profile Page
1 parent b93239d commit 99d378b

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

docs/tc.md

-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Collection of small Topcoder-related functions.
1111
* [tc](#module_tc)
1212
* [.REVIEW_OPPORTUNITY_TYPES](#module_tc.REVIEW_OPPORTUNITY_TYPES)
1313
* [.getApiResponsePayload(res)](#module_tc.getApiResponsePayload) ⇒ <code>Promise</code>
14-
* [.getApiResponsePayloadV3(res)](#module_tc.getApiResponsePayloadV3) ⇒ <code>Promise</code>
1514

1615
<a name="module_tc.REVIEW_OPPORTUNITY_TYPES"></a>
1716

@@ -32,15 +31,3 @@ an error in case of a failure response.
3231
| --- | --- |
3332
| res | <code>Object</code> |
3433

35-
<a name="module_tc.getApiResponsePayloadV3"></a>
36-
37-
### tc.getApiResponsePayloadV3(res) ⇒ <code>Promise</code>
38-
Gets payload from a standard success response from TC v3 API; or throws
39-
an error in case of a failure response.
40-
41-
**Kind**: static method of [<code>tc</code>](#module_tc)
42-
**Returns**: <code>Promise</code> - Resolves to the payload.
43-
44-
| Param | Type |
45-
| --- | --- |
46-
| res | <code>Object</code> |

src/services/user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { config, isomorphy } from 'topcoder-react-utils';
77

88
import logger from '../utils/logger';
9-
import { getApiResponsePayload, getApiResponsePayloadV3 } from '../utils/tc';
9+
import { getApiResponsePayload } from '../utils/tc';
1010
import { getApi } from './api';
1111

1212
let auth0;
@@ -148,7 +148,7 @@ class User {
148148
*/
149149
async getUserPublicV3(username) {
150150
const res = await this.private.api.get(`/members/${username}`);
151-
return getApiResponsePayloadV3(res);
151+
return getApiResponsePayload(res);
152152
}
153153

154154
/**

src/utils/tc.js

-13
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@ export async function getApiResponsePayload(res) {
3838
return x.content;
3939
}
4040

41-
/**
42-
* Gets payload from a standard success response from TC API v3; or throws
43-
* an error in case of a failure response.
44-
* @param {Object} res
45-
* @return {Promise} Resolves to the payload.
46-
*/
47-
export async function getApiResponsePayloadV3(res) {
48-
if (!res.ok) throw new Error(res.statusText);
49-
const x = (await res.json()).result;
50-
if (!x.success) throw new Error(x.content);
51-
return x.content;
52-
}
53-
5441
/**
5542
* Gets payload from a standard success response from TC LOOKER API; or throws
5643
* an error in case of a failure response.

0 commit comments

Comments
 (0)