Skip to content

Commit

Permalink
Merge pull request #368 from navikt/update-sentry-lib
Browse files Browse the repository at this point in the history
Update Sentry dependency
  • Loading branch information
otenav authored Apr 26, 2022
2 parents 0b5ef6f + 0e1c1bb commit 70a5ab2
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 82 deletions.
126 changes: 63 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@navikt/arbeidsplassen-core": "2.0.0",
"@navikt/arbeidsplassen-knapper": "2.0.2",
"@sentry/browser": "^5.20.1",
"@sentry/browser": "^6.19.6",
"@types/react-router-dom": "^4.3.5",
"amplitude-js": "^8.5.0",
"body-parser": "^1.19.0",
Expand Down
38 changes: 20 additions & 18 deletions src/context/AuthenticationProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@ const allowedRedirectUrls = [
CONTEXT_PATH
];

/**
* Om man logget inn mens man var inne på en stillingsannonse, så vil loginservice
* redirecte til en url med dette url-formatet: '/stillinger/stilling?uuid=12345'.
* Redirecter derfor til riktig url-format: '/stillinger/stilling/:uuid'
*/
export function fixUrlAfterLogin() {
if (window.location.pathname === `${CONTEXT_PATH}/stilling`) {
const uuid = extractParam('uuid');
window.history.replaceState(
{},
"",
`${CONTEXT_PATH}/stilling/${uuid}`
);
} else if (window.location.pathname === `${CONTEXT_PATH}/intern`) {
const uuid = extractParam('uuid');
window.history.replaceState({}, "", `${CONTEXT_PATH}/intern/${uuid}`);
}
}

const AuthenticationProvider = ({ children }) => {
const [authenticationStatus, setAuthenticationStatus] = useState(AuthenticationStatus.NOT_FETCHED);
Expand Down Expand Up @@ -151,3 +133,23 @@ AuthenticationProvider.propTypes = {
};

export default AuthenticationProvider;


/**
* Om man logget inn mens man var inne på en stillingsannonse, så vil loginservice
* redirecte til en url med dette url-formatet: '/stillinger/stilling?uuid=12345'.
* Redirecter derfor til riktig url-format: '/stillinger/stilling/:uuid'
*/
export function fixUrlAfterLogin() {
if (window.location.pathname === `${CONTEXT_PATH}/stilling`) {
const uuid = extractParam('uuid');
window.history.replaceState(
{},
"",
`${CONTEXT_PATH}/stilling/${uuid}`
);
} else if (window.location.pathname === `${CONTEXT_PATH}/intern`) {
const uuid = extractParam('uuid');
window.history.replaceState({}, "", `${CONTEXT_PATH}/intern/${uuid}`);
}
}

0 comments on commit 70a5ab2

Please sign in to comment.