mirror of
https://github.com/khairul169/vaulterm.git
synced 2026-09-15 17:03:30 +07:00
feat: add desktop build using wails
This commit is contained in:
+26
-2
@@ -1,12 +1,36 @@
|
||||
import React from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Redirect } from "expo-router";
|
||||
import { useTermSession } from "@/stores/terminal-sessions";
|
||||
import { useServer } from "@/stores/app";
|
||||
import { setLocalServer, useServer } from "@/stores/app";
|
||||
import { GetLocalServer } from "@/lib/wailsjs/go/main/App";
|
||||
import { Spinner, View } from "tamagui";
|
||||
|
||||
export default function index() {
|
||||
const { sessions, curSession } = useTermSession();
|
||||
const [isPending, setPending] = useState(true);
|
||||
const curServer = useServer();
|
||||
|
||||
useEffect(() => {
|
||||
// load local server
|
||||
(async function () {
|
||||
try {
|
||||
const url = await GetLocalServer();
|
||||
if (url) {
|
||||
setLocalServer(url);
|
||||
}
|
||||
} catch (_) {}
|
||||
setPending(false);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
if (isPending) {
|
||||
return (
|
||||
<View flex={1} alignItems="center" justifyContent="center">
|
||||
<Spinner />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
if (!curServer) {
|
||||
return <Redirect href="/server" />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user