修复用户认证错误。

This commit is contained in:
Zhang Jianbin committed 2025-04-27 17:47:35 +08:00
1 parent b4aaaecf8b
commit de98f95ea0
3 files changed
+6 -6

No files matched your search

@@ -223,7 +223,7 @@ export const SSYAccountView = () => {
}
return (
<div className="h-full flex flex-col">
{user ? (
{user && user.Wallet ? (
<div className="flex flex-col pr-3 h-full">
<div className="flex flex-col w-full">
<div className="flex items-center mb-6 flex-wrap gap-y-4">
@@ -274,7 +274,7 @@ export const SSYAccountView = () => {
) : (
<>
<span>$</span>
<CountUp end={(rate * user.Wallet.Assets) / 10000} duration={0.66} decimals={2} />
<CountUp end={(rate * user.Wallet?.Assets) / 10000} duration={0.66} decimals={2} />
<VSCodeButton
appearance="icon"
className="mt-1"
@@ -310,7 +310,7 @@ export const SSYAccountView = () => {
<p style={{}}>注册一个帐户以访问最新型号,注册账单仪表板以查看使用情况和积分, 以及更多即将推出的功能。</p>
<VSCodeButton onClick={handleLogin} className="w-full mb-4">
注册 Cline
注册 / 登录 Cline
</VSCodeButton>
<p className="text-[var(--vscode-descriptionForeground)] text-xs text-center m-0">
继续即表示您同意 <VSCodeLink href="https://cline.bot/tos">服务条款</VSCodeLink> 和{" "}
@@ -161,7 +161,7 @@ const SSYModelPicker: React.FC<SSYModelPickerProps> = ({ isPopup }) => {
<DropdownWrapper ref={dropdownRef}>
<VSCodeTextField
id="model-search"
placeholder="Search and select a model..."
placeholder="搜索模型..."
value={searchTerm}
onInput={(e) => {
handleModelChange((e.target as HTMLInputElement)?.value?.toLowerCase())
+2 -2
View File
@@ -29,7 +29,7 @@ export const SsyAuthProvider: React.FC<{ children: React.ReactNode }> = ({ child
}
const uri = "https://api.shengsuanyun.com/user/info"
const res = await axios.get(uri, reqConfig)
if (!res.data || !res.data.data) {
if (!res.data || !res.data.data || res.data.code != 0) {
throw new Error(`Invalid response from ${uri} API`)
}
const usi = {
@@ -42,7 +42,7 @@ export const SsyAuthProvider: React.FC<{ children: React.ReactNode }> = ({ child
}
setUser(usi)
setIsInitialized(true)
console.log("onAuthStateChanged user", usi)
console.log("SsyAuthProvider onAuthStateChanged user", usi)
vscode.postMessage({
type: "authStateChanged",
userSSY: usi,