Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislaw-zakrzewski committed Oct 23, 2024
1 parent 5e04403 commit 75558dc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions verification/curator-service/ui/src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,15 @@ export default function App(): JSX.Element {
};

const onModalClose = (): void => {
let parsedSearchQuery: string = '';
if (searchQuery.includes('?q=')) {
parsedSearchQuery = `?q=${encodeURIComponent(searchQuery.split('?q=')[1])}`;
} else if (searchQuery.includes('&q=')) {
parsedSearchQuery = `${searchQuery.split('&q=')[0]}&q=${encodeURIComponent(searchQuery.split('&q=')[1])}`;
} else {
parsedSearchQuery = searchQuery;
}
const searchQueryObject = new URLSearchParams(searchQuery);

navigate(
{
pathname:
location.state && location.state.lastLocation
? location.state.lastLocation
: '/cases',
search: parsedSearchQuery,
search: searchQueryObject.toString(),
},
{ state: { lastLocation: '/case/view' } },
);
Expand Down Expand Up @@ -380,7 +373,8 @@ export default function App(): JSX.Element {
)
return;

dispatch(setSearchQuery(decodeURIComponent(location.search)));
const searchParams = new URLSearchParams(location.search);
dispatch(setSearchQuery(searchParams.toString()));

// Save searchQuery to local storage not to lost it when user goes through auth process
localStorage.setItem('searchQuery', location.search);
Expand Down

0 comments on commit 75558dc

Please sign in to comment.