Skip to content

Commit

Permalink
Add support for semicolon separated searches
Browse files Browse the repository at this point in the history
  • Loading branch information
weberjavi committed Oct 10, 2024
1 parent 772774b commit 6416187
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/fishing-map/features/search/search.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,11 @@ export const fetchVesselSearchThunk = createAsyncThunk(
const filter = (filters as any)[cleanField]
if (filter && isInFieldsAllowed) {
let value = filter
// Supports searching by multiple values separated by comma
if (ADVANCED_SEARCH_FIELDS.includes(field as any) && value?.includes(',')) {
// Supports searching by multiple values separated by comma and semicolon
const regex = /[,;]/
if (ADVANCED_SEARCH_FIELDS.includes(field as any) && regex.test(value)) {
value = (value as string)
.split(',')
.split(regex)
.map((v) => v.trim())
.filter(Boolean)
}
Expand Down

0 comments on commit 6416187

Please sign in to comment.