forked from AkkomaGang/admin-fe
Dispatch URL Search when removing and purging urls
This commit is contained in:
parent
b37f91427f
commit
14a46f7719
1 changed files with 12 additions and 2 deletions
|
@ -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 = {
|
||||||
},
|
},
|
||||||
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 = {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in a new issue