refactor(device-identifier): remove unused reset method and clean up imports
This commit is contained in:
@@ -10,9 +10,7 @@
|
|||||||
* 注:仅在浏览器环境可用;SSR/Server Components 中调用会抛错。
|
* 注:仅在浏览器环境可用;SSR/Server Components 中调用会抛错。
|
||||||
*/
|
*/
|
||||||
import { AuthStorage } from "../data/storage/auth/auth_storage";
|
import { AuthStorage } from "../data/storage/auth/auth_storage";
|
||||||
import { StorageKeys } from "../data/storage/storage_keys";
|
|
||||||
import { AppEnvUtil } from "./app-env";
|
import { AppEnvUtil } from "./app-env";
|
||||||
import { SpAsyncUtil } from "./storage";
|
|
||||||
|
|
||||||
export class DeviceIdentifier {
|
export class DeviceIdentifier {
|
||||||
private cachedId: string | null = null;
|
private cachedId: string | null = null;
|
||||||
@@ -33,15 +31,6 @@ export class DeviceIdentifier {
|
|||||||
return this.cachedId;
|
return this.cachedId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 重置缓存与持久化(用于测试或多账号切换)
|
|
||||||
*/
|
|
||||||
async reset(): Promise<void> {
|
|
||||||
this.cachedId = null;
|
|
||||||
this.initPromise = null;
|
|
||||||
await SpAsyncUtil.remove(StorageKeys.deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async initialize(): Promise<string> {
|
private async initialize(): Promise<string> {
|
||||||
// 1. 优先从 localStorage 读取
|
// 1. 优先从 localStorage 读取
|
||||||
const storedR = await AuthStorage.getInstance().getDeviceId();
|
const storedR = await AuthStorage.getInstance().getDeviceId();
|
||||||
|
|||||||
Reference in New Issue
Block a user