MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / onSubmitWeChatVerificationCode

Function onSubmitWeChatVerificationCode

web/src/components/auth/LoginForm.js:95–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93 };
94
95 const onSubmitWeChatVerificationCode = async () => {
96 if (turnstileEnabled && turnstileToken === '') {
97 showInfo('请稍后几秒重试,Turnstile 正在检查用户环境!');
98 return;
99 }
100 setWechatCodeSubmitLoading(true);
101 try {
102 const res = await API.get(
103 `/api/oauth/wechat?code=${inputs.wechat_verification_code}`,
104 );
105 const { success, message, data } = res.data;
106 if (success) {
107 userDispatch({ type: 'login', payload: data });
108 localStorage.setItem('user', JSON.stringify(data));
109 setUserData(data);
110 updateAPI();
111 navigate('/');
112 showSuccess('登录成功!');
113 setShowWeChatLoginModal(false);
114 } else {
115 showError(message);
116 }
117 } catch (error) {
118 showError('登录失败,请重试');
119 } finally {
120 setWechatCodeSubmitLoading(false);
121 }
122 };
123
124 function handleChange(name, value) {
125 setInputs((inputs) => ({ ...inputs, [name]: value }));

Callers

nothing calls this directly

Calls 5

showInfoFunction · 0.90
setUserDataFunction · 0.90
updateAPIFunction · 0.90
showSuccessFunction · 0.90
showErrorFunction · 0.90

Tested by

no test coverage detected