()
| 71 | const [errors, setErrors] = useState<{ name?: string, short?: string, long?: string, general?: string }>({}) |
| 72 | |
| 73 | async function create() { |
| 74 | setIsCreating(true); |
| 75 | setErrors({}); |
| 76 | |
| 77 | let result = await session.apiClient.createPlugin({ |
| 78 | name: name, |
| 79 | short_description: shortDescription, |
| 80 | long_description: longDescription, |
| 81 | }) |
| 82 | |
| 83 | if (isErrorResponse(result)) { |
| 84 | setErrors({ |
| 85 | general: result.response?.description, |
| 86 | name: result.getFieldError("name"), |
| 87 | short: result.getFieldError("short_description"), |
| 88 | long: result.getFieldError("long_description"), |
| 89 | }) |
| 90 | setIsCreating(false); |
| 91 | } else { |
| 92 | navigate(`/user/plugins/${result.id}`) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | return <Stack direction={"column"} spacing={2}> |
| 97 | <TextField label="Name" variant="outlined" |
no test coverage detected