Skip to content

Commit

Permalink
persistant id desktop webrtc
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Nov 19, 2023
1 parent c370c9c commit 2017b17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion desktop/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { invoke } from "@tauri-apps/api/tauri";
import { DataConnection, Peer } from "peerjs";
import { useEffect, useRef, useState } from "react";
import { useLocalStorage } from 'usehooks-ts';
import { v4 as uuidv4 } from 'uuid';
import successSvg from "./assets/success.svg";
import { BASE_URL } from "./config";
import { createQR } from "./qr";
import { useLocalStorage } from "@uidotdev/usehooks";


enum Action {
Expand All @@ -21,8 +21,11 @@ interface Message {
action: Action;
}



function App() {
const [id, ] = useLocalStorage('id', uuidv4())
console.log('localstorage id => ', id)
const [loading, setLoading] = useState(true);
const [peer, ] = useState(new Peer(id, { pingInterval: 1000 }));
const [conn, setConn] = useState<DataConnection | null>(null);
Expand Down

0 comments on commit 2017b17

Please sign in to comment.