From 14a46f77199807ad86fb9f557b4531a7d7cb36b0 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 6 Sep 2020 19:01:22 +0300 Subject: [PATCH] Dispatch URL Search when removing and purging urls --- src/store/modules/mediaProxyCache.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/store/modules/mediaProxyCache.js b/src/store/modules/mediaProxyCache.js index da50f411..ec6b0704 100644 --- a/src/store/modules/mediaProxyCache.js +++ b/src/store/modules/mediaProxyCache.js @@ -10,6 +10,7 @@ const mediaProxyCache = { loading: false, mediaProxyEnabled: false, pageSize: 50, + searchQuery: '', totalUrlsCount: 0 }, mutations: { @@ -27,6 +28,9 @@ const mediaProxyCache = { }, SET_PAGE: (state, page) => { state.currentPage = page + }, + SET_SEARCH_QUERY: (state, query) => { + state.searchQuery = query } }, actions: { @@ -69,13 +73,19 @@ const mediaProxyCache = { type: 'success', duration: 5 * 1000 }) - if (ban) { + if (ban && state.searchQuery.length === 0) { dispatch('ListBannedUrls', { page: state.currentPage }) + } else if (ban) { + dispatch('SearchUrls', { query: state.searchQuery, page: state.currentPage }) } }, async RemoveBannedUrls({ dispatch, getters, state }, urls) { await removeBannedUrls(urls, getters.authHost, getters.token) - dispatch('ListBannedUrls', { page: state.currentPage }) + if (state.searchQuery.length === 0) { + dispatch('ListBannedUrls', { page: state.currentPage }) + } else { + dispatch('SearchUrls', { query: state.searchQuery, page: state.currentPage }) + } }, async SearchUrls({ commit, dispatch, getters, state }, { query, page }) { if (query.length === 0) {