From 802ae8fae5ef2e957c76d901e5141f5150e44ef3 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Mon, 19 Aug 2024 23:50:46 -0300 Subject: [PATCH] chore: apply linter and prettier code --- src/api/nanoApi.js | 13 ++++++++----- src/screens/nano/BlueprintDetail.js | 30 ++++++++++++++++------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/api/nanoApi.js b/src/api/nanoApi.js index 23b9294c..e81a95a1 100644 --- a/src/api/nanoApi.js +++ b/src/api/nanoApi.js @@ -77,11 +77,14 @@ const nanoApi = { */ getBlueprintSourceCode(blueprintId) { const data = { blueprint_id: blueprintId }; - return requestExplorerServiceV1.get(`node_api/nc_blueprint_source_code`, {params: data}).then((res) => { - return res.data - }, (res) => { - throw new Error(res.data.message); - }); + return requestExplorerServiceV1.get(`node_api/nc_blueprint_source_code`, { params: data }).then( + res => { + return res.data; + }, + res => { + throw new Error(res.data.message); + } + ); }, }; diff --git a/src/screens/nano/BlueprintDetail.js b/src/screens/nano/BlueprintDetail.js index e5a4f1ec..7327c89f 100644 --- a/src/screens/nano/BlueprintDetail.js +++ b/src/screens/nano/BlueprintDetail.js @@ -6,10 +6,10 @@ */ import React, { useEffect, useRef, useState } from 'react'; -import Loading from '../../components/Loading'; -import nanoApi from '../../api/nanoApi'; import hljs from 'highlight.js/lib/core'; import python from 'highlight.js/lib/languages/python'; +import Loading from '../../components/Loading'; +import nanoApi from '../../api/nanoApi'; hljs.registerLanguage('python', python); @@ -41,14 +41,14 @@ function BlueprintDetail(props) { setLoading(true); setBlueprintInformation(null); try { - const blueprintInformation = await nanoApi.getBlueprintInformation(blueprintId); - const blueprintSourceCode = await nanoApi.getBlueprintSourceCode(blueprintId); + const blueprintInformationData = await nanoApi.getBlueprintInformation(blueprintId); + const blueprintSourceCodeData = await nanoApi.getBlueprintSourceCode(blueprintId); if (ignore) { // This is to prevent setting a state after the component has been already cleaned return; } - setBlueprintInformation(blueprintInformation); - setBlueprintSourceCode(blueprintSourceCode.source_code); + setBlueprintInformation(blueprintInformationData); + setBlueprintSourceCode(blueprintSourceCodeData.source_code); } catch (e) { if (ignore) { // This is to prevent setting a state after the component has been already cleaned @@ -142,10 +142,10 @@ function BlueprintDetail(props) { * * @param {Event} e Click event */ - const onToggleShowCode = (e) => { + const onToggleShowCode = e => { e.preventDefault(); setShowCode(!showCode); - } + }; return (
@@ -160,16 +160,20 @@ function BlueprintDetail(props) { {blueprintInformation.name}

Attributes

- { renderBlueprintAttributes() } - { renderBlueprintMethods('public_methods', 'Public Methods') } - { renderBlueprintMethods('private_methods', 'Private Methods') } + {renderBlueprintAttributes()} + {renderBlueprintMethods('public_methods', 'Public Methods')} + {renderBlueprintMethods('private_methods', 'Private Methods')}

Source Code

- onToggleShowCode(e)}>{showCode ? 'Hide' : 'Show'} + onToggleShowCode(e)}> + {showCode ? 'Hide' : 'Show'} +
-            {blueprintSourceCode}
+            
+              {blueprintSourceCode}
+