fix(journey): websocket sync across devices + 404 redirect

- broadcastJourneyEvent now excludes by socket ID instead of user ID,
  so other devices of the same user receive real-time updates (#615)
- Routes pass x-socket-id header through to broadcast functions
- loadJourney handles 404 gracefully — redirects to /journey with
  toast instead of infinite spinner (#616)
This commit is contained in:
Maurice
2026-04-13 23:03:58 +02:00
parent 240b10a192
commit 24bcf6ded8
4 changed files with 27 additions and 15 deletions
+7 -1
View File
@@ -88,6 +88,7 @@ interface JourneyState {
journeys: Journey[]
current: JourneyDetail | null
loading: boolean
notFound: boolean
loadJourneys: () => Promise<void>
loadJourney: (id: number) => Promise<void>
@@ -109,6 +110,7 @@ export const useJourneyStore = create<JourneyState>((set, get) => ({
journeys: [],
current: null,
loading: false,
notFound: false,
loadJourneys: async () => {
set({ loading: true })
@@ -121,10 +123,14 @@ export const useJourneyStore = create<JourneyState>((set, get) => ({
},
loadJourney: async (id) => {
set({ loading: true })
set({ loading: true, notFound: false })
try {
const data = await journeyApi.get(id)
set({ current: data })
} catch (err: any) {
if (err?.response?.status === 404) {
set({ current: null, notFound: true })
}
} finally {
set({ loading: false })
}