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

Function handleEditOutlook

static/js/email_services.js:1046–1080  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1044
1045// 保存编辑 Outlook 服务
1046async function handleEditOutlook(e) {
1047 e.preventDefault();
1048 const id = document.getElementById('edit-outlook-id').value;
1049 const formData = new FormData(e.target);
1050
1051 let currentService;
1052 try {
1053 currentService = await api.get(`/email-services/${id}/full`);
1054 } catch (error) {
1055 toast.error('获取服务信息失败');
1056 return;
1057 }
1058
1059 const updateData = {
1060 name: formData.get('email'),
1061 priority: parseInt(formData.get('priority')) || 0,
1062 enabled: formData.get('enabled') === 'on',
1063 config: {
1064 email: formData.get('email'),
1065 password: formData.get('password')?.trim() || currentService.config?.password || '',
1066 client_id: formData.get('client_id')?.trim() || currentService.config?.client_id || '',
1067 refresh_token: formData.get('refresh_token')?.trim() || currentService.config?.refresh_token || ''
1068 }
1069 };
1070
1071 try {
1072 await api.patch(`/email-services/${id}`, updateData);
1073 toast.success('账户更新成功');
1074 elements.editOutlookModal.classList.remove('active');
1075 loadOutlookServices();
1076 loadStats();
1077 } catch (error) {
1078 toast.error('更新失败: ' + error.message);
1079 }
1080}

Callers

nothing calls this directly

Calls 6

loadOutlookServicesFunction · 0.85
errorMethod · 0.80
successMethod · 0.80
loadStatsFunction · 0.70
getMethod · 0.45
patchMethod · 0.45

Tested by

no test coverage detected