fix: ws now works as expexted

This commit is contained in:
Fredrik Burmester
2024-08-20 08:42:52 +02:00
parent 4873aaf3df
commit 09f953ebba
6 changed files with 111 additions and 125 deletions

19
utils/device.ts Normal file
View File

@@ -0,0 +1,19 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
import uuid from "react-native-uuid";
export const getOrSetDeviceId = async () => {
let deviceId = await AsyncStorage.getItem("deviceId");
if (!deviceId) {
deviceId = uuid.v4() as string;
await AsyncStorage.setItem("deviceId", deviceId);
}
return deviceId;
};
export const getDeviceId = async () => {
let deviceId = await AsyncStorage.getItem("deviceId");
return deviceId || null;
};