diff --git a/src/api/mediaProxyCache.js b/src/api/mediaProxyCache.js index 0822d984..8c19a791 100644 --- a/src/api/mediaProxyCache.js +++ b/src/api/mediaProxyCache.js @@ -2,10 +2,10 @@ import request from '@/utils/request' import { getToken } from '@/utils/auth' import { baseName } from './utils' -export async function listBannedUrls(page, authHost, token) { +export async function listBannedUrls(page, pageSize, authHost, token) { return await request({ baseURL: baseName(authHost), - url: `/api/pleroma/admin/media_proxy_caches?page=${page}`, + url: `/api/pleroma/admin/media_proxy_caches?page=${page}&page_size=${pageSize}`, method: 'get', headers: authHeaders(token) }) diff --git a/src/store/modules/mediaProxyCache.js b/src/store/modules/mediaProxyCache.js index 815c14e4..8e675a44 100644 --- a/src/store/modules/mediaProxyCache.js +++ b/src/store/modules/mediaProxyCache.js @@ -5,16 +5,17 @@ import i18n from '@/lang' const mediaProxyCache = { state: { bannedUrls: [], - bannedUrlsCount: 0, currentPage: 1, - loading: false + loading: false, + pageSize: 50, + totalUrlsCount: 0 }, mutations: { SET_BANNED_URLS: (state, urls) => { state.bannedUrls = urls.map(el => { return { url: el } }) }, - SET_BANNED_URLS_COUNT: (state, count) => { - state.bannedUrlsCount = count + SET_TOTAL_URLS_COUNT: (state, count) => { + state.totalUrlsCount = count }, SET_LOADING: (state, status) => { state.loading = status @@ -24,11 +25,11 @@ const mediaProxyCache = { } }, actions: { - async ListBannedUrls({ commit, getters }, page) { + async ListBannedUrls({ commit, getters, state }, { page }) { commit('SET_LOADING', true) - const response = await listBannedUrls(page, getters.authHost, getters.token) + const response = await listBannedUrls(page, state.pageSize, getters.authHost, getters.token) commit('SET_BANNED_URLS', response.data.urls) - // commit('SET_BANNED_URLS_COUNT', count) + commit('SET_TOTAL_URLS_COUNT', response.data.count) commit('SET_PAGE', page) commit('SET_LOADING', false) }, @@ -40,12 +41,12 @@ const mediaProxyCache = { duration: 5 * 1000 }) if (ban) { - dispatch('ListBannedUrls', state.currentPage) + dispatch('ListBannedUrls', { page: state.currentPage }) } }, async RemoveBannedUrls({ dispatch, getters, state }, urls) { await removeBannedUrls(urls, getters.authHost, getters.token) - dispatch('ListBannedUrls', state.currentPage) + dispatch('ListBannedUrls', { page: state.currentPage }) } } } diff --git a/src/views/mediaProxyCache/index.vue b/src/views/mediaProxyCache/index.vue index 6c37082b..cecfa74e 100644 --- a/src/views/mediaProxyCache/index.vue +++ b/src/views/mediaProxyCache/index.vue @@ -46,6 +46,16 @@ +