Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const initAccount = () => (dispatch, getState) => {
let peerId = localStorage.getItem('peer');
console.log("Peerid: ", peerId);
if(!peerId) {
peerId = short.uuid();
localStorage.setItem('peer', peerId);
}
const peer = webrtc.createPeer(peerId);
const board = localStorage.getItem('board');
let user = localStorage.getItem('user');
peer.on('connection', (_conn) => {
_conn.on('open', (d) => {
console.log('Conn open - receiver side', d);
// closeModal()(dispatch);
});
peer.on('error', (err) => {
console.log('error', err);
if(err.message.indexOf('is taken') !== -1) {
localStorage.setItem('peer', short.uuid());
window.location.reload();
} else if(err.message.indexOf('Could not connect to peer ') !== -1) {
localStorage.removeItem('user');
localStorage.removeItem('board');
}
});
const uuidv4 = () => shortUuid().fromUUID(shortUuid.uuid());
id: string,
author: string,
authorLink: string,
cover: string,
logo: string,
pubDate: string,
title: string,
}),
};
MetaForm.defaultProps = {
cta: "Save",
handleSave: null,
required: false,
story: {
id: shortUuid().fromUUID(shortUuid.uuid()),
author: "",
authorLink: "",
cover: "",
logo: "",
pubDate: "",
title: "",
},
};
const uuidv4 = () => shortUuid().fromUUID(shortUuid.uuid());
const uuidv4 = () => shortUuid().fromUUID(shortUuid.uuid());
const generateRoomId = () => {
let roomId = short.uuid();
while (rooms[roomId]) {
roomId = short.uuid();
}
return roomId;
};
const generateRoomId = () => {
let roomId = short.uuid();
while (rooms[roomId]) {
roomId = short.uuid();
}
return roomId;
};