Skip to content
Snippets Groups Projects
Commit 8f8a916f authored by Angelina Filippova's avatar Angelina Filippova
Browse files

Dispatch URL Search when removing and purging urls

parent 1a5d1c55
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ const mediaProxyCache = { ...@@ -10,6 +10,7 @@ const mediaProxyCache = {
loading: false, loading: false,
mediaProxyEnabled: false, mediaProxyEnabled: false,
pageSize: 50, pageSize: 50,
searchQuery: '',
totalUrlsCount: 0 totalUrlsCount: 0
}, },
mutations: { mutations: {
...@@ -27,6 +28,9 @@ const mediaProxyCache = { ...@@ -27,6 +28,9 @@ const mediaProxyCache = {
}, },
SET_PAGE: (state, page) => { SET_PAGE: (state, page) => {
state.currentPage = page state.currentPage = page
},
SET_SEARCH_QUERY: (state, query) => {
state.searchQuery = query
} }
}, },
actions: { actions: {
...@@ -69,13 +73,19 @@ const mediaProxyCache = { ...@@ -69,13 +73,19 @@ const mediaProxyCache = {
type: 'success', type: 'success',
duration: 5 * 1000 duration: 5 * 1000
}) })
if (ban) { if (ban && state.searchQuery.length === 0) {
dispatch('ListBannedUrls', { page: state.currentPage }) dispatch('ListBannedUrls', { page: state.currentPage })
} else if (ban) {
dispatch('SearchUrls', { query: state.searchQuery, page: state.currentPage })
} }
}, },
async RemoveBannedUrls({ dispatch, getters, state }, urls) { async RemoveBannedUrls({ dispatch, getters, state }, urls) {
await removeBannedUrls(urls, getters.authHost, getters.token) 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 }) { async SearchUrls({ commit, dispatch, getters, state }, { query, page }) {
if (query.length === 0) { if (query.length === 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment