feat: berry theme update & bug fix (#1282)

* ️ improve: delete google fonts

* ️ improve: Optimized priority input handling in TableRow component.

* 🔖 chore: channel batch add

*  feat: add dark mod

*  feat: support token limit ip range and models

*  feat: add MessagePusher

*  feat: add lark login
This commit is contained in:
Buer
2024-04-06 19:44:23 +08:00
committed by GitHub
parent acf8cb6248
commit 3fe2863ff7
40 changed files with 936 additions and 281 deletions

View File

@@ -48,6 +48,28 @@ const useLogin = () => {
}
};
const larkLogin = async (code, state) => {
try {
const res = await API.get(`/api/oauth/lark?code=${code}&state=${state}`);
const { success, message, data } = res.data;
if (success) {
if (message === 'bind') {
showSuccess('绑定成功!');
navigate('/panel');
} else {
dispatch({ type: LOGIN, payload: data });
localStorage.setItem('user', JSON.stringify(data));
showSuccess('登录成功!');
navigate('/panel');
}
}
return { success, message };
} catch (err) {
// 请求失败,设置错误信息
return { success: false, message: '' };
}
};
const wechatLogin = async (code) => {
try {
const res = await API.get(`/api/oauth/wechat?code=${code}`);
@@ -72,7 +94,7 @@ const useLogin = () => {
navigate('/');
};
return { login, logout, githubLogin, wechatLogin };
return { login, logout, githubLogin, wechatLogin, larkLogin };
};
export default useLogin;