[Refactor] Refactor the way import files.
Organize some codes.
This commit is contained in:
28
src-ui/logics/configs/device/useEnableAutoMicSelect.js
Normal file
28
src-ui/logics/configs/device/useEnableAutoMicSelect.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_EnableAutoMicSelect } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useEnableAutoMicSelect = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
|
||||
|
||||
const getEnableAutoMicSelect = () => {
|
||||
pendingEnableAutoMicSelect();
|
||||
asyncStdoutToPython("/get/data/auto_mic_select");
|
||||
};
|
||||
|
||||
const toggleEnableAutoMicSelect = () => {
|
||||
pendingEnableAutoMicSelect();
|
||||
if (currentEnableAutoMicSelect.data) {
|
||||
asyncStdoutToPython("/set/disable/auto_mic_select");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/auto_mic_select");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentEnableAutoMicSelect,
|
||||
getEnableAutoMicSelect,
|
||||
updateEnableAutoMicSelect,
|
||||
toggleEnableAutoMicSelect,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user