Skip to content

Commit

Permalink
Fix: got rid of type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Raduc4 committed Jul 23, 2023
1 parent 08b05a7 commit b4c9f4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
1 change: 1 addition & 0 deletions framework/app/c2s/useRegister_c2s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type RegisterHookDescriptor = {
invokerInput: {
uuid: string;
fullName: string;
serverAddr: string;
username: string;
proposedPassword: string;
};
Expand Down
8 changes: 5 additions & 3 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ function CustomApp({
Component,
pageProps,
}: AppProps & { Component: { Layout: FC<{ children: ReactNode }> } }) {
const [uuid, setUuid] = useState<any>();
const [uuid, setUuid] = useState<string>('');
const [connErr, setErr] = useState('');

useEffect(() => {
const gen = async () => {
if (uuid) return;
try {
const uuid_value = await invoke('open_tcp_conn', { 'addr': '127.0.0.1:3000' });
setUuid(uuid_value)
const uuid_value: string = await invoke('open_tcp_conn', {
addr: '127.0.0.1:3000',
});
setUuid(uuid_value);
} catch (error) {
setErr(error as string);
}
Expand Down
20 changes: 4 additions & 16 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { Layout } from '@components/common/Layout';
import React from 'react';
import Chat from '@components/chat';
import { useApiProvider } from '@framework';
import { useRegister_c2s } from '@framework/c2s';
import { invoke } from '@tauri-apps/api/tauri';

export default function Home({
uuid,
connErr,
}: {
cid: string;
uuid: string;
connErr: string;
}) {
console.log(connErr);
Expand All @@ -22,28 +20,18 @@ export default function Home({
className="text-red-500"
onClick={async () => {
const data = await registerC2s({
uuid: '39e6d86d-f757-4fee-99cd-ba925dd077bd',
uuid,
fullName: 'John Doe ',
username: 'johndoe',
serverAddr: '127.0.0.1:3000',
proposedPassword: '_Rudsakjdas123',
});
console.log(data);
}}
>
Register
</button>
<button
className="text-red-500 mt-20"
onClick={async () => {
const data = await registerC2s({
uuid: '39e6d86d-f757-4fee-99cd-ba925dd077bd',
fullName: 'John Doe ',
username: 'johndoe',
proposedPassword: '_Rudsakjdas123',
});
console.log(data);
}}
></button>

<main className="pt-10 h-full w-full flex flex-col justify-between">
{/* <span className="text-yellow-400">{uuid.to_string()}</span> */}
<Chat />
Expand Down

0 comments on commit b4c9f4f

Please sign in to comment.