mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-12 23:40:26 +00:00
check for search and queryParams
This commit is contained in:
parent
3de87ce5bd
commit
30c3e4b6ed
1 changed files with 8 additions and 2 deletions
|
|
@ -14,14 +14,20 @@ const useSelectedAddon = (transportUrl) => {
|
|||
|
||||
fetch(transportUrl)
|
||||
.then((resp) => resp.json())
|
||||
.then((manifest) => setAddon({ ...manifest, transportUrl }));
|
||||
.then((manifest) => setAddon({ manifest, transportUrl, flags: {} }));
|
||||
}, [transportUrl]);
|
||||
const clear = React.useCallback(() => {
|
||||
if (active) {
|
||||
const { pathname, search } = UrlUtils.parse(locationHash.slice(1));
|
||||
const queryParams = new URLSearchParams(search);
|
||||
queryParams.delete('addon');
|
||||
window.location.replace(`#${pathname}?${queryParams.toString()}`);
|
||||
if (search && queryParams) {
|
||||
window.location.replace(`#${pathname}?${queryParams.toString()}`);
|
||||
}
|
||||
else {
|
||||
window.location.replace(`#${pathname}`);
|
||||
}
|
||||
setAddon(null);
|
||||
}
|
||||
}, [active]);
|
||||
return [addon, clear];
|
||||
|
|
|
|||
Loading…
Reference in a new issue