s3si.ts/gui/src/pages/Home.tsx

30 lines
758 B
TypeScript
Raw Normal View History

2023-03-04 08:10:30 -05:00
import React from 'react'
2023-03-04 06:19:24 -05:00
import { WebviewWindow } from '@tauri-apps/api/window'
2023-03-03 09:29:46 -05:00
import { Loading } from 'components/Loading'
2023-03-05 12:56:07 -05:00
import { JSONRPCClient, S3SIService, StdioTransport } from 'jsonrpc';
2023-03-04 08:10:30 -05:00
2023-03-05 12:56:07 -05:00
const client = new JSONRPCClient<S3SIService>({
transport: new StdioTransport()
}).getProxy();
2023-03-03 09:06:14 -05:00
export const Home: React.FC = ({ }) => {
2023-03-05 12:56:07 -05:00
const onHello = async () => {
const result = await client.loginSteps();
console.log(result)
if (result.error) {
throw new Error(result.error.message);
}
const webview = new WebviewWindow('login', {
2023-03-04 06:19:24 -05:00
url: 'https://accounts.nintendo.com/',
2023-03-05 12:56:07 -05:00
resizable: true,
2023-03-04 06:19:24 -05:00
focus: true,
2023-03-05 12:56:07 -05:00
});
2023-03-04 08:10:30 -05:00
}
2023-03-03 09:06:14 -05:00
return <>
2023-03-03 09:29:46 -05:00
Hello world! <Loading />
2023-03-04 08:10:30 -05:00
<button onClick={onHello}>Hello</button>
2023-03-05 12:56:07 -05:00
2023-03-03 09:06:14 -05:00
</>
2023-03-04 06:19:24 -05:00
}