Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions packages/nc-gui/composables/useSharedFormViewStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,24 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const pk = extractPkFromRow(newRecord, meta.value?.columns as ColumnType[])

if (pk && isValidRedirectUrl.value) {
const url = sharedFormView.value!.redirect_url!.replace('{record_id}', pk)
window.location.href = url
window.location.reload()
const redirectUrl = sharedFormView.value!.redirect_url!.replace('{record_id}', pk)

// Create an anchor element to parse the URL
const anchor = document.createElement('a')
anchor.href = redirectUrl

// Check if the redirect URL has the same host as the current page
const isSameHost = anchor.host === window.location.host

if (isSameHost) {
// Use pushState for internal links
window.history.pushState({}, 'Redirect', redirectUrl)
// Reload the page
window.location.reload()
} else {
// For external links, use window.location.href
window.location.href = redirectUrl
}
} else {
submitted.value = true
progress.value = false
Expand Down
Loading