feat: support hook for custom api

This commit is contained in:
Gabe Yuan
2024-05-12 16:10:11 +08:00
parent 5d44ff4913
commit f908372b4e
8 changed files with 125 additions and 73 deletions

View File

@@ -119,7 +119,8 @@ function ApiFields({ translator }) {
fetchInterval = DEFAULT_FETCH_INTERVAL,
dictNo = "",
memoryNo = "",
customOption = "",
reqHook = "",
resHook = "",
} = api;
const handleChange = (e) => {
@@ -244,15 +245,26 @@ function ApiFields({ translator }) {
)}
{translator.startsWith(OPT_TRANS_CUSTOMIZE) && (
<TextField
size="small"
label={i18n("custom_option")}
name="customOption"
value={customOption}
onChange={handleChange}
multiline
maxRows={10}
/>
<>
<TextField
size="small"
label={"Request Hook"}
name="reqHook"
value={reqHook}
onChange={handleChange}
multiline
maxRows={10}
/>
<TextField
size="small"
label={"Response Hook"}
name="resHook"
value={resHook}
onChange={handleChange}
multiline
maxRows={10}
/>
</>
)}
<TextField