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-10 18:49:18 +07:00
|
|
|
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();
|
2024-11-10 18:49:18 +07:00
|
|
|
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
|
|
|
}
|