File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ const App = () => {
36
36
return ;
37
37
}
38
38
39
- const params = utils . url . parseUrlQuery ( location . search ) ;
39
+ let search = location . href . split ( '?' ) . length ? '?' + location . href . split ( '?' ) [ 1 ] : ''
40
+ const params = utils . url . parseUrlQuery ( search ) ;
40
41
const toUpdate = utils . challenge . createChallengeFilter ( params ) ;
41
42
42
43
if ( ! toUpdate . types ) toUpdate . types = [ ] ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import { getService as getSubmissionsService } from "./submissions";
17
17
* @return {Array<Object> } challenges
18
18
*/
19
19
async function getChallenges ( filter , cancellationSignal ) {
20
- const challengeQuery = util . buildQueryString ( filter ) ;
20
+ const challengeQuery = util . buildQueryString ( filter , true ) ;
21
21
return api . get (
22
22
`/challenges/${ challengeQuery } ` ,
23
23
undefined ,
Original file line number Diff line number Diff line change @@ -15,9 +15,11 @@ import qs from "qs";
15
15
* @params {Object<{[key: string]: any}> } params Query string parameters
16
16
* @return {String }
17
17
*/
18
- export function buildQueryString ( params ) {
18
+ export function buildQueryString ( params , disableEncode ) {
19
19
params = _ . omitBy ( params , ( p ) => p == null || p === "" || p . length === 0 ) ;
20
-
20
+ if ( ! disableEncode ) {
21
+ params . tags = _ . map ( params . tags , ( t ) => encodeURIComponent ( t ) )
22
+ }
21
23
let queryString = qs . stringify ( params , {
22
24
encode : false ,
23
25
arrayFormat : "brackets" ,
@@ -28,7 +30,11 @@ export function buildQueryString(params) {
28
30
}
29
31
30
32
export function parseUrlQuery ( queryString ) {
31
- return qs . parse ( queryString , { ignoreQueryPrefix : true } ) ;
33
+ let params = qs . parse ( queryString , { ignoreQueryPrefix : true } ) ;
34
+ if ( params . tags ) {
35
+ params . tags = _ . map ( params . tags , ( t ) => decodeURIComponent ( t ) )
36
+ }
37
+ return params
32
38
}
33
39
34
40
export function updateQuery ( params ) {
You can’t perform that action at this time.
0 commit comments