Skip to content

Commit 391cd7f

Browse files
committed
Fix token count
1 parent 98498ca commit 391cd7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/server/control/admin-users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function formatUser (user: User): Object {
66
id: user.id,
77
name: user.name,
88
tokenLimit: user.tokenLimit,
9-
tokensCount: user.tokenIds.split(',').length,
9+
tokensCount: user.tokenIds.split(',').filter(t => t !== '').length,
1010
email: user.email,
1111
githubLogin: user.githubLogin,
1212
avatarUrl: user.avatarUrl,

src/server/control/token.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export async function newToken (user: User, userId: string, name: string): Promi
3030
})
3131
await updateStatics('tokenCount', 1)
3232
await UserModel.update({ id: user.id }, {
33-
tokenIds: user.tokenIds.split(',').concat([token.id]).join(','),
34-
dataIds: user.dataIds.split(',').concat([data.id]).join(',')
33+
tokenIds: user.tokenIds.split(',').concat([token.id]).filter(t => t !== '').join(','),
34+
dataIds: user.dataIds.split(',').concat([data.id]).filter(d => d !== '').join(',')
3535
})
3636
token.id = sign(token.id)
3737
return token

0 commit comments

Comments
 (0)