Skip to content

Commit

Permalink
UPDATE: to overwrite window location href instead of creating a link …
Browse files Browse the repository at this point in the history
…element
  • Loading branch information
JeremiahUy committed Dec 6, 2023
1 parent 06554e2 commit dfebc79
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,9 @@ export const EtterlevelseKravView = ({

//Navigate to same component does not work
//Work around for redirecting to same component
//create a anchor tag with new url and trigger it
const redirectOnSameComponent = (nextKravPath: string) => {
const currentPath = location.pathname.split('/krav')
var a = document.createElement('a')
var linkText = document.createTextNode('Sender til neste krav')
a.appendChild(linkText)
a.title = 'Sender til neste krav'
a.href = currentPath[0] + '/krav' + nextKravPath
a.id = 'SendToNextKrav'
document.body.appendChild(a)
document.getElementById('SendToNextKrav')?.click()
window.location.href = currentPath[0] + '/krav' + nextKravPath
}

const submit = async (etterlevelse: Etterlevelse) => {
Expand Down

0 comments on commit dfebc79

Please sign in to comment.