(e)
| 753 | |
| 754 | // 添加邮箱服务 |
| 755 | async function handleAddService(e) { |
| 756 | e.preventDefault(); |
| 757 | |
| 758 | const formData = new FormData(elements.addServiceForm); |
| 759 | const config = {}; |
| 760 | |
| 761 | elements.serviceConfigFields.querySelectorAll('input').forEach(input => { |
| 762 | config[input.name] = input.value; |
| 763 | }); |
| 764 | |
| 765 | const data = { |
| 766 | service_type: formData.get('service_type'), |
| 767 | name: formData.get('name'), |
| 768 | config: config, |
| 769 | enabled: true, |
| 770 | priority: 0, |
| 771 | }; |
| 772 | |
| 773 | try { |
| 774 | await api.post('/email-services', data); |
| 775 | toast.success('邮箱服务已添加'); |
| 776 | elements.addServiceModal.classList.remove('active'); |
| 777 | elements.addServiceForm.reset(); |
| 778 | loadEmailServices(); |
| 779 | } catch (error) { |
| 780 | toast.error('添加失败: ' + error.message); |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | // 测试服务 |
| 785 | async function testService(id) { |
nothing calls this directly
no test coverage detected