code refactor

This commit is contained in:
MaysWind
2024-12-30 23:11:03 +08:00
parent 2560a70e5e
commit 863e0205ff
6 changed files with 21 additions and 35 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import uaParser from 'ua-parser-js';
import { CliUserAgent, type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
import { TOKEN_CLI_USER_AGENT, type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
interface UserAgentInfo {
device: {
@@ -39,7 +39,7 @@ function parseUserAgent(ua: string): UserAgentInfo {
}
function isSessionUserAgentCreatedByCli(ua: string): boolean {
return ua === CliUserAgent;
return ua === TOKEN_CLI_USER_AGENT;
}
function parseDeviceInfo(uaInfo: UserAgentInfo): string {