DONE: add customer pages, implement auth on teller page
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { DEVICE_TOKEN_KEY } from "./constants";
|
||||
|
||||
export function getDeviceToken(): string {
|
||||
if (typeof window === "undefined") {
|
||||
return "";
|
||||
}
|
||||
|
||||
const existing = window.localStorage.getItem(DEVICE_TOKEN_KEY);
|
||||
if (existing) {
|
||||
return existing;
|
||||
}
|
||||
|
||||
const token =
|
||||
typeof crypto !== "undefined" && "randomUUID" in crypto
|
||||
? crypto.randomUUID()
|
||||
: `web-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||
|
||||
window.localStorage.setItem(DEVICE_TOKEN_KEY, token);
|
||||
return token;
|
||||
}
|
||||
Reference in New Issue
Block a user