vaulterm/frontend/app/index.tsx

20 lines
473 B
TypeScript
Raw Normal View History

2024-11-08 18:24:08 +07:00
import React from "react";
import { Redirect } from "expo-router";
2024-11-08 18:53:30 +00:00
import { useTermSession } from "@/stores/terminal-sessions";
2024-11-12 04:43:59 +07:00
import { useServer } from "@/stores/app";
2024-11-08 18:24:08 +07:00
export default function index() {
2024-11-08 18:53:30 +00:00
const { sessions, curSession } = useTermSession();
2024-11-12 04:43:59 +07:00
const curServer = useServer();
2024-11-12 04:43:59 +07:00
if (!curServer) {
return <Redirect href="/server" />;
}
2024-11-08 18:53:30 +00:00
return (
<Redirect
href={sessions.length > 0 && curSession >= 0 ? "/terminal" : "/hosts"}
/>
);
2024-11-08 18:24:08 +07:00
}