]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/rest/rest.service.ts
Migrate to $localize
[github/Chocobozzz/PeerTube.git] / client / src / app / core / rest / rest.service.ts
index c12b6bd41c22849a06263a2a6bbd18498c572328..4f1fc884846f636b6f4baee4c8738b5394c57681 100644 (file)
@@ -9,11 +9,12 @@ interface QueryStringFilterPrefixes {
     prefix: string
     handler?: (v: string) => string | number
     multiple?: boolean
+    isBoolean?: boolean
   }
 }
 
 type ParseQueryStringFilterResult = {
-  [key: string]: string | number | (string | number)[]
+  [key: string]: string | number | boolean | (string | number | boolean)[]
 }
 
 @Injectable()
@@ -48,7 +49,7 @@ export class RestService {
       const value = object[name]
       if (value === undefined || value === null) continue
 
-      if (Array.isArray(value) && value.length !== 0) {
+      if (Array.isArray(value)) {
         for (const v of value) params = params.append(name, v)
       } else {
         params = params.append(name, value)
@@ -96,6 +97,7 @@ export class RestService {
                                     return t
                                   })
                                   .filter(t => !!t || t === 0)
+                                  .map(t => prefixObj.isBoolean ? t === 'true' : t)
 
       if (matchedTokens.length === 0) continue