| 42 | }) |
| 43 | |
| 44 | function initialRoute(value: unknown): Route | undefined { |
| 45 | if (!value || typeof value !== "object" || !("type" in value)) return |
| 46 | if (value.type === "home") return { type: "home" } |
| 47 | if (value.type === "session" && "sessionID" in value && typeof value.sessionID === "string") { |
| 48 | return { type: "session", sessionID: value.sessionID } |
| 49 | } |
| 50 | if (value.type === "plugin" && "id" in value && typeof value.id === "string") { |
| 51 | return { type: "plugin", id: value.id } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export type RouteContext = ReturnType<typeof useRoute> |
| 56 | |