vaulterm/frontend/app/index.tsx

20 lines
509 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";
import { useAppStore } 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();
const { servers, curServer } = useAppStore();
if (!servers.length || !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
}