diff --git a/client/admin/brewUtils/brewLookup/brewLookup.jsx b/client/admin/brewUtils/brewLookup/brewLookup.jsx index fa5784501..922613559 100644 --- a/client/admin/brewUtils/brewLookup/brewLookup.jsx +++ b/client/admin/brewUtils/brewLookup/brewLookup.jsx @@ -1,3 +1,5 @@ +require('./brewLookup.less'); + const React = require('react'); const createClass = require('create-react-class'); const cx = require('classnames'); @@ -27,18 +29,21 @@ const BrewLookup = createClass({ this.setState({ searching: true, error: null, checkForScript: false, scriptCount: undefined }); request.get(`/admin/lookup/${this.state.query}`) - .then((res)=>this.setState({ foundBrew: res.body })) + .then((res)=>{ + const foundBrew = res.body; + const scriptCheck = foundBrew.text.match(/(<\/?s)cript/); + this.setState({ + foundBrew : foundBrew, + scriptCount : scriptCheck?.length || 0, + checkForScript : scriptCheck?.length > 0 + }); + }) .catch((err)=>this.setState({ error: err })) - .finally(()=>this.setState({ searching: false })); - }, - - checkForScript(){ - const brew = this.state.foundBrew; - const scriptCheck = brew.text.match(/(<\/?s)cript/); - this.setState({ - checkForScript : !!scriptCheck, - scriptCount : scriptCheck?.length || 0 - }); + .finally(()=>{ + this.setState({ + searching : false + }); + }); }, cleanScript(){ @@ -71,10 +76,15 @@ const BrewLookup = createClass({
Number of SCRIPT tags found: {this.state.scriptCount}
} - {this.state.checkForScript && } + {this.state.checkForScript && +