Skip to content

Commit

Permalink
Merge pull request #472 from entur/fix/auto-redirect-broken
Browse files Browse the repository at this point in the history
Fix app not redirecting to root on page that doesnt exist
  • Loading branch information
magnusrand authored Sep 22, 2021
2 parents 2448d70 + 33e5865 commit 1a9ecbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export function useSettings(): [Settings | null, Setter] {
}

if (id) {
return onSnapshot(getSettings(id), (document: any) => {
if (!document.exists) {
return onSnapshot(getSettings(id), (documentSnapshot: any) => {
if (!documentSnapshot.exists()) {
window.location.pathname = '/'
return
}

const data = document.data() as Settings
const data = documentSnapshot.data() as Settings

const settingsWithDefaults: Settings = {
...DEFAULT_SETTINGS,
Expand Down

0 comments on commit 1a9ecbd

Please sign in to comment.