From 717117af4b59e21b04c47c0933beeae3daa55e65 Mon Sep 17 00:00:00 2001 From: jesQM Date: Fri, 24 Apr 2020 10:20:00 +0200 Subject: [PATCH] Better code quality --- src/components/podService/podStoreHandler.js | 12 ++++++------ src/components/routeList/RouteCard.js | 6 ++++-- src/pages/RouteSharedList.js | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/podService/podStoreHandler.js b/src/components/podService/podStoreHandler.js index 1cff1d6..a81fe06 100644 --- a/src/components/podService/podStoreHandler.js +++ b/src/components/podService/podStoreHandler.js @@ -130,7 +130,7 @@ export default class PodStorageHandler extends PodHandler{ let routeObject = new MyRoute(); routeObject.modifyFromJsonLd(JSON.parse(content)); forEachRoute(routeObject); - }, (error) => {forEachRoute(null)} ); + }, (error) => {forEachRoute(null);} ); } }.bind(this)); } @@ -149,7 +149,7 @@ export default class PodStorageHandler extends PodHandler{ const parser = new N3.Parser(); parser.parse(content, function (error, quad, prefixes) { // parse the content of the message if (quad) { - if ( quad.predicate.id == "http://schema.org/text" && quad.object.id.includes("/viade/routes/") ) { // If the quad is the url of the route + if ( quad.predicate.id === "http://schema.org/text" && quad.object.id.includes("/viade/routes/") ) { // If the quad is the url of the route forEachMail(quad.object.id); this.sharedRoutesToAdd.push(quad.object.id.split("\"").join("")); } @@ -197,7 +197,7 @@ export default class PodStorageHandler extends PodHandler{ file = JSON.parse(file); } catch (e) { if (e.status !== 404) { - throw e + throw e; } else { file = { "@context": { @@ -209,14 +209,14 @@ export default class PodStorageHandler extends PodHandler{ "viade": "http://arquisoft.github.io/viadeSpec/" }, "routes": [] - } + }; } } // 2.- Remove duplicated routes - let alreadyRoutes = file["routes"].map((url) => {return url["@id"]}); + let alreadyRoutes = file["routes"].map((url) => {return url["@id"];}); urls.forEach((url) => { - if (alreadyRoutes.indexOf(url) == -1) { + if (alreadyRoutes.indexOf(url) === -1) { alreadyRoutes.push( url ); } }); diff --git a/src/components/routeList/RouteCard.js b/src/components/routeList/RouteCard.js index f4c3bc2..c670cb5 100644 --- a/src/components/routeList/RouteCard.js +++ b/src/components/routeList/RouteCard.js @@ -16,12 +16,14 @@ class RouteCard extends React.Component { /> }; this.showShareButton = true; - if (props.showShareButton !== undefined) + if (props.showShareButton !== undefined) { this.showShareButton = props.showShareButton; + } this.showInfoButton = true; - if (props.showInfoButton !== undefined) + if (props.showInfoButton !== undefined) { this.showInfoButton = props.showInfoButton; + } } render() { diff --git a/src/pages/RouteSharedList.js b/src/pages/RouteSharedList.js index a07bff9..5854744 100644 --- a/src/pages/RouteSharedList.js +++ b/src/pages/RouteSharedList.js @@ -14,7 +14,7 @@ export default class RouteSharedList extends RouteList { constructor(props) { super(props); - if (props.sync == undefined || props.sync == true) + if (props.sync === undefined || props.sync == true) this.readInbox(); } @@ -29,7 +29,7 @@ export default class RouteSharedList extends RouteList { routesForCardDecks.push( {this.state.sharedRoutes.slice(counter, counter + this.cardDeckSize).map( - (r) => {return } + (r) => {return ;} )} );