mirror of
https://github.com/aljazceru/sendstr-web.git
synced 2025-12-17 06:24:24 +01:00
feat: auto connect on scan
This commit is contained in:
@@ -87,6 +87,15 @@ export const SendView = ({ keys }: SendViewProps) => {
|
||||
})()
|
||||
}, [])
|
||||
|
||||
const onMessageChange = (message: string) => {
|
||||
setMessage(message)
|
||||
sendMessage(peerKey, message)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (peerKey !== "") onMessageChange("")
|
||||
}, [peerKey])
|
||||
|
||||
const sendMessage = useRef(
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
debounce(async (peerKey: string, message: string) => {
|
||||
@@ -96,11 +105,6 @@ export const SendView = ({ keys }: SendViewProps) => {
|
||||
}, 500),
|
||||
).current
|
||||
|
||||
const onMessageChange = (message: string) => {
|
||||
setMessage(message)
|
||||
sendMessage(peerKey, message)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{showScan && (
|
||||
|
||||
Reference in New Issue
Block a user