Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions client/js/helpers/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export function filterTypeToString(type: FilterType): string {
return 'unread';
} else if (type == FilterType.STARRED) {
return 'starred';
} else {
throw new Error(`Invalid filter type: “${type}”`);
}
}

Expand All @@ -70,6 +72,13 @@ export function useEntriesParams(): Params | null {
}

const { params } = match;

if (!params.filter || !params.category) {
Comment thread
Denperidge marked this conversation as resolved.
// Note: it isn't possible to reach this part of the code
// This is to keep the TypeScript compiler happy
return null;
}

const filterValid = /^(newest|unread|starred)$/.test(params.filter);
const categoryValid = /^(all|tag-.+|source-[0-9]+)$/.test(params.category);
const idValid = params.id === undefined || /^\d+$/.test(params.id);
Expand Down