Something went wrong. Try again.
fork of ozone with nix stuff
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829import { v4 as uuidv4 } from 'uuid'
const BATCH_ID_KEY = 'ozone-workspace-batch-id'
export const generateBatchId = (): string => { // Generate a unique ID with timestamp to ensure uniqueness across users const timestamp = Date.now() const uuid = uuidv4() return `${timestamp}-${uuid}`}
export const getBatchId = (): string => { let batchId = localStorage.getItem(BATCH_ID_KEY) if (!batchId) { batchId = generateBatchId() localStorage.setItem(BATCH_ID_KEY, batchId) } return batchId}
export const setBatchId = (batchId: string): void => { localStorage.setItem(BATCH_ID_KEY, batchId)}
export const regenerateBatchId = (): string => { const newBatchId = generateBatchId() localStorage.setItem(BATCH_ID_KEY, newBatchId) return newBatchId}