[Update] Config Page: Add Device tab. add mic host list.(not selectable yet.)

This commit is contained in:
Sakamoto Shiina
2024-09-02 17:04:34 +09:00
parent 6c68f3744f
commit 26691f773f
15 changed files with 140 additions and 26 deletions

View File

@@ -1,22 +1,34 @@
import {
useSoftwareVersion,
useMicHostList,
useSelectedMicHost,
} from "@store";
import { useStdoutToPython } from "./useStdoutToPython";
export const useConfig = () => {
const {
updateSoftwareVersion,
} = useSoftwareVersion();
import { arrayToObject } from "@utils/arrayToObject";
export const useConfig = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { updateSoftwareVersion } = useSoftwareVersion();
const { updateMicHostList } = useMicHostList();
const { updateSelectedMicHost } = useSelectedMicHost();
return {
getSoftwareVersion: () => {
asyncStdoutToPython("/config/version");
getSoftwareVersion: () => asyncStdoutToPython("/config/version"),
updateSoftwareVersion: (payload) => updateSoftwareVersion(payload.data),
getMicHostList: () => asyncStdoutToPython("/controller/list_mic_host"),
updateMicHostList: (payload) => {
updateMicHostList(arrayToObject(payload.data));
},
updateSoftwareVersion: (payload) => {
updateSoftwareVersion(payload.data);
getSelectedMicHost: () => asyncStdoutToPython("/config/choice_mic_host"),
updateSelectedMicHost: (payload) => {
updateSelectedMicHost(payload.data);
},
};
};