[Refactor] Logic: Move object structure creation to the parent file.
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { store } from "@store";
|
||||
|
||||
export const useStdoutToPython = () => {
|
||||
const asyncStdoutToPython = async (value) => {
|
||||
const asyncStdoutToPython = async (path, value) => {
|
||||
let send_object = { endpoint: path };
|
||||
if (value) send_object.data = value;
|
||||
|
||||
// send to python
|
||||
const backend_subprocess = store.backend_subprocess;
|
||||
if (backend_subprocess) {
|
||||
await backend_subprocess.write(JSON.stringify(value) + "\n").then(() => {
|
||||
await backend_subprocess.write(JSON.stringify(send_object) + "\n").then(() => {
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user