Skip to content

Commit e3fca11

Browse files
committed
修复令牌bug
1 parent f01932d commit e3fca11

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

model/token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func SearchUserTokens(userId int, keyword string, token string) (tokens []*Token
3333
if token != "" {
3434
token = strings.Trim(token, "sk-")
3535
}
36-
err = DB.Where("user_id = ?", userId).Where("name LIKE ? or key LIKE ?", keyword+"%", token+"%").Find(&tokens).Error
36+
err = DB.Where("user_id = ?", userId).Where("name LIKE ?", keyword+"%").Where("key LIKE ?", token+"%").Find(&tokens).Error
3737
return tokens, err
3838
}
3939

web/src/components/TokensTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,14 @@ const TokensTable = () => {
377377
};
378378

379379
const searchTokens = async () => {
380-
if (searchKeyword === '') {
380+
if (searchKeyword === '' && searchToken === '') {
381381
// if keyword is blank, load files instead.
382382
await loadTokens(0);
383383
setActivePage(1);
384384
return;
385385
}
386386
setSearching(true);
387-
const res = await API.get(`/api/token/search?keyword=${searchKeyword}`);
387+
const res = await API.get(`/api/token/search?keyword=${searchKeyword}&token=${searchToken}`);
388388
const {success, message, data} = res.data;
389389
if (success) {
390390
setTokensFormat(data);

0 commit comments

Comments
 (0)