| 44 | ) => Vue.Ref<UseSearchResult<TRouter, TFrom, true, TSelected>> |
| 45 | |
| 46 | export function useSearch< |
| 47 | TRouter extends AnyRouter = RegisteredRouter, |
| 48 | const TFrom extends string | undefined = undefined, |
| 49 | TStrict extends boolean = true, |
| 50 | TThrow extends boolean = true, |
| 51 | TSelected = unknown, |
| 52 | >( |
| 53 | opts: UseSearchOptions< |
| 54 | TRouter, |
| 55 | TFrom, |
| 56 | TStrict, |
| 57 | ThrowConstraint<TStrict, TThrow>, |
| 58 | TSelected |
| 59 | >, |
| 60 | ): Vue.Ref< |
| 61 | ThrowOrOptional<UseSearchResult<TRouter, TFrom, TStrict, TSelected>, TThrow> |
| 62 | > { |
| 63 | return useMatch({ |
| 64 | from: opts.from!, |
| 65 | strict: opts.strict, |
| 66 | shouldThrow: opts.shouldThrow, |
| 67 | select: (match: any) => { |
| 68 | return opts.select ? opts.select(match.search) : match.search |
| 69 | }, |
| 70 | }) as any |
| 71 | } |