diff options
Diffstat (limited to 'client/src/app/core/rest/rest.service.ts')
-rw-r--r-- | client/src/app/core/rest/rest.service.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/client/src/app/core/rest/rest.service.ts b/client/src/app/core/rest/rest.service.ts index 93b5f56b2..59152e658 100644 --- a/client/src/app/core/rest/rest.service.ts +++ b/client/src/app/core/rest/rest.service.ts | |||
@@ -1,13 +1,16 @@ | |||
1 | import * as debug from 'debug' | ||
1 | import { SortMeta } from 'primeng/api' | 2 | import { SortMeta } from 'primeng/api' |
2 | import { HttpParams } from '@angular/common/http' | 3 | import { HttpParams } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
4 | import { ComponentPaginationLight } from './component-pagination.model' | 5 | import { ComponentPaginationLight } from './component-pagination.model' |
5 | import { RestPagination } from './rest-pagination' | 6 | import { RestPagination } from './rest-pagination' |
6 | 7 | ||
8 | const logger = debug('peertube:rest') | ||
9 | |||
7 | interface QueryStringFilterPrefixes { | 10 | interface QueryStringFilterPrefixes { |
8 | [key: string]: { | 11 | [key: string]: { |
9 | prefix: string | 12 | prefix: string |
10 | handler?: (v: string) => string | number | 13 | handler?: (v: string) => string | number | boolean |
11 | multiple?: boolean | 14 | multiple?: boolean |
12 | isBoolean?: boolean | 15 | isBoolean?: boolean |
13 | } | 16 | } |
@@ -87,6 +90,8 @@ export class RestService { | |||
87 | const prefixeStrings = Object.values(prefixes) | 90 | const prefixeStrings = Object.values(prefixes) |
88 | .map(p => p.prefix) | 91 | .map(p => p.prefix) |
89 | 92 | ||
93 | logger(`Built tokens "${tokens.join(', ')}" for prefixes "${prefixeStrings.join(', ')}"`) | ||
94 | |||
90 | // Search is the querystring minus defined filters | 95 | // Search is the querystring minus defined filters |
91 | const searchTokens = tokens.filter(t => { | 96 | const searchTokens = tokens.filter(t => { |
92 | return prefixeStrings.every(prefixString => t.startsWith(prefixString) === false) | 97 | return prefixeStrings.every(prefixString => t.startsWith(prefixString) === false) |
@@ -122,8 +127,12 @@ export class RestService { | |||
122 | : matchedTokens[0] | 127 | : matchedTokens[0] |
123 | } | 128 | } |
124 | 129 | ||
130 | const search = searchTokens.join(' ') || undefined | ||
131 | |||
132 | logger('Built search: ' + search, additionalFilters) | ||
133 | |||
125 | return { | 134 | return { |
126 | search: searchTokens.join(' ') || undefined, | 135 | search, |
127 | 136 | ||
128 | ...additionalFilters | 137 | ...additionalFilters |
129 | } | 138 | } |