Create actions for listing banned urls, purge and remove banned urls form cachex
This commit is contained in:
parent
9d2a86556c
commit
764621d6fd
2 changed files with 52 additions and 1 deletions
|
@ -5,6 +5,7 @@ import emojiPacks from './modules/emojiPacks'
|
|||
import errorLog from './modules/errorLog'
|
||||
import getters from './getters'
|
||||
import invites from './modules/invites'
|
||||
import mediaProxyCache from './modules/mediaProxyCache'
|
||||
import moderationLog from './modules/moderationLog'
|
||||
import peers from './modules/peers'
|
||||
import permission from './modules/permission'
|
||||
|
@ -24,8 +25,9 @@ const store = new Vuex.Store({
|
|||
app,
|
||||
errorLog,
|
||||
emojiPacks,
|
||||
moderationLog,
|
||||
invites,
|
||||
mediaProxyCache,
|
||||
moderationLog,
|
||||
peers,
|
||||
permission,
|
||||
relays,
|
||||
|
|
49
src/store/modules/mediaProxyCache.js
Normal file
49
src/store/modules/mediaProxyCache.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { listBannedUrls, purgeUrls, removeBannedUrls } from '@/api/mediaProxyCache'
|
||||
import { Message } from 'element-ui'
|
||||
import i18n from '@/lang'
|
||||
|
||||
const mediaProxyCache = {
|
||||
state: {
|
||||
bannedUrls: [],
|
||||
bannedUrlsCount: 0,
|
||||
currentPage: 1,
|
||||
loading: false
|
||||
},
|
||||
mutations: {
|
||||
SET_BANNED_URLS: (state, urls) => {
|
||||
state.bannedUrls = urls
|
||||
},
|
||||
SET_BANNED_URLS_COUNT: (state, count) => {
|
||||
state.bannedUrlsCount = count
|
||||
},
|
||||
SET_LOADING: (state, status) => {
|
||||
state.loading = status
|
||||
},
|
||||
SET_PAGE: (state, page) => {
|
||||
state.currentPage = page
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async ListBannedUrls({ commit, getters }, page) {
|
||||
commit('SET_LOADING', true)
|
||||
const response = await listBannedUrls(page, getters.authHost, getters.token)
|
||||
commit('SET_BANNED_URLS', response.data.urls)
|
||||
// commit('SET_BANNED_URLS_COUNT', count)
|
||||
commit('SET_PAGE', page)
|
||||
commit('SET_LOADING', false)
|
||||
},
|
||||
async PurgeUrls({ commit, getters }, { urls, ban }) {
|
||||
await purgeUrls(urls, ban, getters.authHost, getters.token)
|
||||
Message({
|
||||
message: i18n.t('mediaProxyCache.evictedMessage'),
|
||||
type: 'success',
|
||||
duration: 5 * 1000
|
||||
})
|
||||
},
|
||||
async RemoveBannedUrls({ commit, getters }, urls) {
|
||||
await removeBannedUrls(urls, getters.authHost, getters.token)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default mediaProxyCache
|
Loading…
Reference in a new issue