Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleIfAddLinkOrStandardMessage = (data) => {
if (data.startsWith("http")) {
console.log("HERE!");
// Assume it is a link.
const tokens = data.split(' ');
let title = "";
if (tokens.length > 1) {
// Can form title.
title = tokens.slice(1, tokens.length).join(' ');
} else {
title = 'Here is a link!';
}
const url = tokens[0];
addLinkSnippet({"title": title, "link": url, "target": url});
} else {
addResponseMessage(data);
}
if (this.state.toggleOpen) this.state.unread++;
console.log(this.state.toggleOpen);
};