MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / handleAddService

Function handleAddService

static/js/settings.js:755–782  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

753
754// 添加邮箱服务
755async 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// 测试服务
785async function testService(id) {

Callers

nothing calls this directly

Calls 5

loadEmailServicesFunction · 0.85
successMethod · 0.80
errorMethod · 0.80
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected