File tree 3 files changed +8
-6
lines changed
3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,14 @@ import { getApi } from '../services/api';
16
16
function loadProfileDone ( userTokenV3 ) {
17
17
if ( ! userTokenV3 ) return Promise . resolve ( null ) ;
18
18
const user = decodeToken ( userTokenV3 ) ;
19
- const api = getApi ( 'V3 ' , userTokenV3 ) ;
19
+ const api = getApi ( 'V5 ' , userTokenV3 ) ;
20
20
return Promise . all ( [
21
21
api . get ( `/members/${ user . handle } ` )
22
- . then ( res => res . json ( ) ) . then ( res => ( res . result . status === 200 ? res . result . content : { } ) ) ,
22
+ . then ( res => ( res . ok ? res . json ( ) : new Error ( res . statusText ) ) )
23
+ . then ( res => ( res . message ? new Error ( res . message ) : res [ 0 ] ) ) ,
23
24
api . get ( `/groups?memberId=${ user . userId } &membershipType=user` )
24
- . then ( res => res . json ( ) ) . then ( res => ( res . result . status === 200 ? res . result . content : [ ] ) ) ,
25
+ . then ( res => ( res . ok ? res . json ( ) : new Error ( res . statusText ) ) )
26
+ . then ( res => ( res . message ? new Error ( res . message ) : res ) ) ,
25
27
] ) . then ( ( [ profile , groups ] ) => ( { ...profile , groups } ) ) ;
26
28
}
27
29
Original file line number Diff line number Diff line change @@ -170,8 +170,8 @@ function mergeGroup(groups, group) {
170
170
* @param {Object } group
171
171
* @return {String[] } Array of IDs.
172
172
*/
173
- export function reduceGroupIds ( { oldId , subGroups } ) {
174
- let res = [ oldId ] ;
173
+ export function reduceGroupIds ( { id , subGroups } ) {
174
+ let res = [ id ] ;
175
175
if ( subGroups ) {
176
176
subGroups . forEach ( ( g ) => {
177
177
res = res . concat ( reduceGroupIds ( g ) ) ;
Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ export function mapToBackend(filter) {
382
382
if ( filter . or ) return { } ;
383
383
384
384
const res = { } ;
385
- if ( filter . groupIds ) res . groupIds = filter . groupIds . join ( ',' ) ;
385
+ if ( filter . groupIds ) res . groupIds = filter . groupIds ; // filter.groupIds .join(',');
386
386
387
387
/* NOTE: Right now the frontend challenge filter by tag works different,
388
388
* it looks for matches in the challenge name OR in the techs / platforms. */
You can’t perform that action at this time.
0 commit comments