From 3a3e8cf260d0b86a2b69d1993991aeeb32e0a636 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 29 May 2019 10:32:29 +0300 Subject: [PATCH] fix js style --- .../assets/js/pages/address/logs.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/apps/block_scout_web/assets/js/pages/address/logs.js b/apps/block_scout_web/assets/js/pages/address/logs.js index 063480619e..99ac742679 100644 --- a/apps/block_scout_web/assets/js/pages/address/logs.js +++ b/apps/block_scout_web/assets/js/pages/address/logs.js @@ -47,29 +47,27 @@ const elements = { } } +function loadSearchItems () { + var topic = $('[data-search-field]').val(); + var path = "/search_logs?topic=" + topic + "&address_id=" + store.getState().addressHash + store.dispatch({type: 'START_REQUEST'}) + $.getJSON(path, {type: 'JSON'}) + .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) + .always(() => store.dispatch({type: 'FINISH_REQUEST'})) +} + if ($('[data-page="address-logs"]').length) { const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash const $element = $('[data-async-listing]') - connectElements({ store, elements }) store.dispatch({ type: 'PAGE_LOAD', addressHash: addressHash}) - function loadSearchItems () { - var topic = $('[data-search-field]').val(); - var path = "/search_logs?topic=" + topic + "&address_id=" + store.getState().addressHash - store.dispatch({type: 'START_REQUEST'}) - $.getJSON(path, {type: 'JSON'}) - .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_REQUEST'})) - } - - $element.on('click', '[data-search-button]', (event) => { store.dispatch({ type: 'START_SEARCH',