@@ -16,24 +16,19 @@ import { useQuery } from "@tanstack/react-query";
16
16
import request from "@/utils/request" ;
17
17
18
18
import useFunctionStore from "../../store" ;
19
- import CreateModal from "../CreateModal" ;
19
+
20
+ import CreateModal from "./CreateModal" ;
20
21
21
22
import commonStyles from "../../index.module.scss" ;
22
23
import styles from "./index.module.scss" ;
23
24
24
25
export default function FunctionList ( ) {
25
26
const store = useFunctionStore ( ( store ) => store ) ;
26
27
27
- const { data } = useQuery ( [ "functions" ] , ( ) => {
28
- return request . get ( "/api/function_list" ) ;
29
- } ) ;
30
-
31
- console . log ( 123 , data ) ;
32
-
33
28
return (
34
29
< div >
35
30
< div className = { commonStyles . sectionHeader + " flex justify-between" } >
36
- < h4 className = "m-2" > 函数列表</ h4 >
31
+ < h4 > 函数列表</ h4 >
37
32
< HStack spacing = "2" >
38
33
< SunIcon />
39
34
< CreateModal />
@@ -70,13 +65,13 @@ export default function FunctionList() {
70
65
71
66
< h5 className = "m-2" > 所有函数</ h5 >
72
67
< ul className = { styles . functionList + " mb-4" } >
73
- { ( data ?. data || [ ] ) . map ( ( func : any ) => {
68
+ { ( store . allFunctionList || [ ] ) . map ( ( func : any ) => {
74
69
return (
75
70
< li
76
- className = { func . id === store . currentFunction ? styles . active : "" }
71
+ className = { func . _id === store . currentFunction ?. _id ? styles . active : "" }
77
72
key = { func . _id }
78
73
onClick = { ( ) => {
79
- store . setCurrentFunction ( func . _id ) ;
74
+ store . setCurrentFunction ( func ) ;
80
75
} }
81
76
>
82
77
< div >
0 commit comments