@@ -4,7 +4,7 @@ import { Button } from "@components/Button";
44
55
66import { UsbConfigState } from "../hooks/stores" ;
7- import { useJsonRpc } from "../hooks/useJsonRpc" ;
7+ import { JsonRpcResponse , useJsonRpc } from "../hooks/useJsonRpc" ;
88import notifications from "../notifications" ;
99import { SettingsItem } from "../routes/devices.$id.settings" ;
1010
@@ -54,7 +54,7 @@ const usbConfigs = [
5454type UsbConfigMap = Record < string , USBConfig > ;
5555
5656export function UsbInfoSetting ( ) {
57- const [ send ] = useJsonRpc ( ) ;
57+ const { send } = useJsonRpc ( ) ;
5858 const [ loading , setLoading ] = useState ( false ) ;
5959
6060 const [ usbConfigProduct , setUsbConfigProduct ] = useState ( "" ) ;
@@ -94,7 +94,7 @@ export function UsbInfoSetting() {
9494 ) ;
9595
9696 const syncUsbConfigProduct = useCallback ( ( ) => {
97- send ( "getUsbConfig" , { } , resp => {
97+ send ( "getUsbConfig" , { } , ( resp : JsonRpcResponse ) => {
9898 if ( "error" in resp ) {
9999 console . error ( "Failed to load USB Config:" , resp . error ) ;
100100 notifications . error (
@@ -114,7 +114,7 @@ export function UsbInfoSetting() {
114114 const handleUsbConfigChange = useCallback (
115115 ( usbConfig : USBConfig ) => {
116116 setLoading ( true ) ;
117- send ( "setUsbConfig" , { usbConfig } , async resp => {
117+ send ( "setUsbConfig" , { usbConfig } , async ( resp : JsonRpcResponse ) => {
118118 if ( "error" in resp ) {
119119 notifications . error (
120120 `Failed to set usb config: ${ resp . error . data || "Unknown error" } ` ,
@@ -137,7 +137,7 @@ export function UsbInfoSetting() {
137137 ) ;
138138
139139 useEffect ( ( ) => {
140- send ( "getDeviceID" , { } , async resp => {
140+ send ( "getDeviceID" , { } , async ( resp : JsonRpcResponse ) => {
141141 if ( "error" in resp ) {
142142 return notifications . error (
143143 `Failed to get device ID: ${ resp . error . data || "Unknown error" } ` ,
@@ -205,10 +205,10 @@ function USBConfigDialog({
205205 product : "" ,
206206 } ) ;
207207
208- const [ send ] = useJsonRpc ( ) ;
208+ const { send } = useJsonRpc ( ) ;
209209
210210 const syncUsbConfig = useCallback ( ( ) => {
211- send ( "getUsbConfig" , { } , resp => {
211+ send ( "getUsbConfig" , { } , ( resp : JsonRpcResponse ) => {
212212 if ( "error" in resp ) {
213213 console . error ( "Failed to load USB Config:" , resp . error ) ;
214214 } else {
0 commit comments