Skip to content

Commit

Permalink
fix: /omp page
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-mng committed Sep 13, 2024
1 parent 02bcad6 commit b935439
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/web/pages/omp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import React from 'react';

import {withRouter} from 'web/utils/withRouter';

import PropTypes from 'web/utils/proptypes';
import {useNavigate, useSearchParams} from 'react-router-dom';
import {useEffect} from 'react';

Check warning on line 7 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L6-L7

Added lines #L6 - L7 were not covered by tests

/**
* Component to redirect old secinfo urls like
Expand All @@ -16,9 +13,12 @@ import PropTypes from 'web/utils/proptypes';
*
* to the current replacement pages
*/
class LegacyOmpPage extends React.Component {
componentDidMount() {
const {navigate, searchParams} = this.props;

const OmpComponent = () => {
const navigate = useNavigate();
const [searchParams] = useSearchParams();

Check warning on line 19 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L17-L19

Added lines #L17 - L19 were not covered by tests

useEffect(() => {
const cmd = searchParams.get('cmd');
const info_type = searchParams.get('info_type');
const info_id = searchParams.get('info_id') || '';

Check warning on line 24 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L21-L24

Added lines #L21 - L24 were not covered by tests
Expand Down Expand Up @@ -50,16 +50,9 @@ class LegacyOmpPage extends React.Component {
navigate('/notfound', {replace: true});

Check warning on line 50 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L50

Added line #L50 was not covered by tests
break;
}
}

render() {
return null;
}
}
}, [navigate, searchParams]);

Check warning on line 53 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L53

Added line #L53 was not covered by tests

LegacyOmpPage.propTypes = {
navigate: PropTypes.object.isRequired,
searchParams: PropTypes.object.isRequired,
return null;

Check warning on line 55 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L55

Added line #L55 was not covered by tests
};

export default withRouter(LegacyOmpPage);
export default OmpComponent;

Check warning on line 58 in src/web/pages/omp.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/pages/omp.jsx#L58

Added line #L58 was not covered by tests

0 comments on commit b935439

Please sign in to comment.