]>
Commit | Line | Data |
---|---|---|
400043b1 C |
1 | async function searchLocalUrl <T> (url: string, finder: (url: string) => Promise<T>) { |
2 | const data = await finder(url) | |
3 | if (data) return data | |
4 | ||
5 | return finder(removeQueryParams(url)) | |
6 | } | |
7 | ||
8 | export { | |
9 | searchLocalUrl | |
10 | } | |
11 | ||
12 | // --------------------------------------------------------------------------- | |
13 | ||
14 | function removeQueryParams (url: string) { | |
15 | return url.split('?').shift() | |
16 | } |