()
| 40 | const [isLoading, setIsLoading] = useState(false); |
| 41 | |
| 42 | const handleSave = async () => { |
| 43 | toast.promise( |
| 44 | async () => { |
| 45 | setIsLoading(true); |
| 46 | try { |
| 47 | const newProject = await createProject( |
| 48 | organizationId, |
| 49 | formData, |
| 50 | ); |
| 51 | await onProjectCreated(); // Call the callback to refresh the project list |
| 52 | handleClose(); // Automatically close the modal after successful creation |
| 53 | return newProject; // Return for the success message |
| 54 | } catch (error) { |
| 55 | console.error("Failed to create project:", error); |
| 56 | throw error; // Rethrow for the error message |
| 57 | } finally { |
| 58 | setIsLoading(false); |
| 59 | } |
| 60 | }, |
| 61 | { |
| 62 | loading: "Creating project...", |
| 63 | success: "Project created successfully!", |
| 64 | error: "Failed to create project", |
| 65 | }, |
| 66 | ); |
| 67 | }; |
| 68 | |
| 69 | const handleClose = () => { |
| 70 | // Reset state when closing |
nothing calls this directly
no test coverage detected
searching dependent graphs…