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

Function validateToken

static/js/accounts.js:1078–1101  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

1076}
1077
1078async function validateToken(id) {
1079 try {
1080 toast.info('正在验证Token...');
1081 const result = await api.post(`/accounts/${id}/validate`, {}, {
1082 timeoutMs: 30000,
1083 retry: 0,
1084 });
1085
1086 const nextStatus = String(result?.status || '').trim().toLowerCase();
1087 if (nextStatus) {
1088 replaceAccountRowStatus(id, nextStatus);
1089 }
1090
1091 if (result.valid) {
1092 toast.success('Token 验证通过');
1093 } else {
1094 toast.warning(`Token 无效: ${result.error || '未知错误'}`, 5000);
1095 }
1096
1097 await refreshAccountsView({ settleDelayMs: 80 });
1098 } catch (error) {
1099 toast.error('验证失败: ' + error.message);
1100 }
1101}
1102
1103async function runBatchRefreshTask(payload, count, sourceLabel, options = {}) {
1104 const showToast = options.showToast !== false;

Callers

nothing calls this directly

Calls 7

replaceAccountRowStatusFunction · 0.85
refreshAccountsViewFunction · 0.85
infoMethod · 0.80
successMethod · 0.80
warningMethod · 0.80
errorMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected