@@ -4,7 +4,7 @@ import { Button } from "@components/Button";
4
4
5
5
6
6
import { UsbConfigState } from "../hooks/stores" ;
7
- import { useJsonRpc } from "../hooks/useJsonRpc" ;
7
+ import { JsonRpcResponse , useJsonRpc } from "../hooks/useJsonRpc" ;
8
8
import notifications from "../notifications" ;
9
9
import { SettingsItem } from "../routes/devices.$id.settings" ;
10
10
@@ -54,7 +54,7 @@ const usbConfigs = [
54
54
type UsbConfigMap = Record < string , USBConfig > ;
55
55
56
56
export function UsbInfoSetting ( ) {
57
- const [ send ] = useJsonRpc ( ) ;
57
+ const { send } = useJsonRpc ( ) ;
58
58
const [ loading , setLoading ] = useState ( false ) ;
59
59
60
60
const [ usbConfigProduct , setUsbConfigProduct ] = useState ( "" ) ;
@@ -94,7 +94,7 @@ export function UsbInfoSetting() {
94
94
) ;
95
95
96
96
const syncUsbConfigProduct = useCallback ( ( ) => {
97
- send ( "getUsbConfig" , { } , resp => {
97
+ send ( "getUsbConfig" , { } , ( resp : JsonRpcResponse ) => {
98
98
if ( "error" in resp ) {
99
99
console . error ( "Failed to load USB Config:" , resp . error ) ;
100
100
notifications . error (
@@ -114,7 +114,7 @@ export function UsbInfoSetting() {
114
114
const handleUsbConfigChange = useCallback (
115
115
( usbConfig : USBConfig ) => {
116
116
setLoading ( true ) ;
117
- send ( "setUsbConfig" , { usbConfig } , async resp => {
117
+ send ( "setUsbConfig" , { usbConfig } , async ( resp : JsonRpcResponse ) => {
118
118
if ( "error" in resp ) {
119
119
notifications . error (
120
120
`Failed to set usb config: ${ resp . error . data || "Unknown error" } ` ,
@@ -137,7 +137,7 @@ export function UsbInfoSetting() {
137
137
) ;
138
138
139
139
useEffect ( ( ) => {
140
- send ( "getDeviceID" , { } , async resp => {
140
+ send ( "getDeviceID" , { } , async ( resp : JsonRpcResponse ) => {
141
141
if ( "error" in resp ) {
142
142
return notifications . error (
143
143
`Failed to get device ID: ${ resp . error . data || "Unknown error" } ` ,
@@ -205,10 +205,10 @@ function USBConfigDialog({
205
205
product : "" ,
206
206
} ) ;
207
207
208
- const [ send ] = useJsonRpc ( ) ;
208
+ const { send } = useJsonRpc ( ) ;
209
209
210
210
const syncUsbConfig = useCallback ( ( ) => {
211
- send ( "getUsbConfig" , { } , resp => {
211
+ send ( "getUsbConfig" , { } , ( resp : JsonRpcResponse ) => {
212
212
if ( "error" in resp ) {
213
213
console . error ( "Failed to load USB Config:" , resp . error ) ;
214
214
} else {
0 commit comments