增加打手登录设备管理与三台设备限制
This commit is contained in:
@@ -3,11 +3,24 @@ const WORKER_EXPIRES_AT_KEY = 'order-site-worker-token-expires-at'
|
||||
const WORKER_ID_KEY = 'order-site-worker-id'
|
||||
const WORKER_USERNAME_KEY = 'order-site-worker-username'
|
||||
const WORKER_STATUS_KEY = 'order-site-worker-status'
|
||||
const WORKER_DEVICE_ID_KEY = 'order-site-worker-device-id'
|
||||
|
||||
export function getWorkerToken() {
|
||||
return localStorage.getItem(WORKER_TOKEN_KEY) || ''
|
||||
}
|
||||
|
||||
export function getWorkerDeviceId() {
|
||||
let deviceId = localStorage.getItem(WORKER_DEVICE_ID_KEY) || ''
|
||||
if (!deviceId) {
|
||||
deviceId =
|
||||
typeof crypto.randomUUID === 'function'
|
||||
? crypto.randomUUID()
|
||||
: `${Date.now()}-${Math.random().toString(36).slice(2)}`
|
||||
localStorage.setItem(WORKER_DEVICE_ID_KEY, deviceId)
|
||||
}
|
||||
return deviceId
|
||||
}
|
||||
|
||||
export function getWorkerTokenExpiresAt() {
|
||||
return localStorage.getItem(WORKER_EXPIRES_AT_KEY) || ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user