File size: 571 Bytes
3c3f089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { useAppDispatch } from "../store/hook";
import {
  set_monaco_input_value,
  set_editor_value,
  clear_logs,
} from "../store/features/editorSlice";
import { close_modal } from "../store/features/modalSlice";
import { EditorValueInterface } from "../_types/editorTypes";

export const useTree = () => {
  const dispatch = useAppDispatch();

  const setTree = (data: EditorValueInterface) => {
    dispatch(clear_logs());
    dispatch(set_monaco_input_value(data));
    dispatch(set_editor_value(data));
    dispatch(close_modal());
  };

  return { setTree };
};