@@ -19,7 +19,7 @@ const options = require('./boxen-options')
1919 * Check specifically if the user decided to quit the program or wanted to make another search
2020 * @param {String } input The picked choice after prompt
2121 */
22- function _checkUserAnswers ( input ) {
22+ function _checkUserAnswers ( input , lang ) {
2323 if ( input . userPick . includes ( '(Try another search)' ) ) {
2424 process . stdout . write ( '\u001Bc' ) // Clear the console
2525 header . logAppName ( )
@@ -36,6 +36,8 @@ function _checkUserAnswers(input) {
3636 if ( input . userPick . includes ( '(Quit)' ) ) {
3737 process . exit ( 1 )
3838 }
39+
40+ config . storeSearches ( input . userPick , lang )
3941}
4042
4143/**
@@ -125,11 +127,10 @@ async function _askForATopic() {
125127 */
126128async function _refineTopics ( ) {
127129 const input = await qoa . interactive ( prompt . topicInteractive )
128- await _checkUserAnswers ( input )
129130 const lang = await config . checkLang ( )
131+ await _checkUserAnswers ( input , lang )
130132 const response = await fetch . getArticle ( input . userPick , lang )
131133
132- config . storeSearches ( input . userPick , lang )
133134 _displayArticle ( response )
134135 prompt . topicInteractive . menu = [ ]
135136}
@@ -218,8 +219,7 @@ const displayRandomArticlesList = async () => {
218219 const suggestedTopics = await fetch . getRandomSuggestions ( lang )
219220 _fillInteractiveTopicsName ( suggestedTopics , 'randomInteractive' )
220221 const input = await qoa . interactive ( prompt . randomInteractive )
221- await _checkUserAnswers ( input )
222- config . storeSearches ( input . userPick , lang )
222+ await _checkUserAnswers ( input , lang )
223223 const response = await fetch . getArticle ( input . userPick , lang )
224224 _displayArticle ( response )
225225 prompt . historyInteractive . menu = [ ]
0 commit comments