| 24 | }; |
| 25 | |
| 26 | const handleSave = async (model: string) => { |
| 27 | if (!editValues.input_price_per_m || !editValues.output_price_per_m) return; |
| 28 | |
| 29 | try { |
| 30 | await updatePricing.mutateAsync({ |
| 31 | model, |
| 32 | input_price_per_m: editValues.input_price_per_m, |
| 33 | output_price_per_m: editValues.output_price_per_m, |
| 34 | currency: editValues.currency || 'USD', |
| 35 | }); |
| 36 | setEditingModel(null); |
| 37 | refetch(); |
| 38 | } catch (error) { |
| 39 | console.error('Failed to update pricing:', error); |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | const handleAddModel = async () => { |
| 44 | if (!newModel.model) return; |