(subject: string)
| 18 | |
| 19 | /** Constructs a URL for opening a resource form. */ |
| 20 | export function openURL(subject: string): string { |
| 21 | const url = new URL(subject); |
| 22 | if (window.location.origin == url.origin) { |
| 23 | const path = url.pathname + url.search; |
| 24 | if (path == '/') return ''; |
| 25 | return path; |
| 26 | } else { |
| 27 | return constructURL(paths.show, 'subject', subject); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export function searchURL(query: string): string { |
| 32 | return constructURL(paths.search, 'query', query); |
no test coverage detected