forked from AkkomaGang/admin-fe
Create API functions for MediaProxy Cache
This commit is contained in:
parent
2881730f33
commit
0aff86e638
1 changed files with 34 additions and 0 deletions
34
src/api/mediaProxyCache.js
Normal file
34
src/api/mediaProxyCache.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
import request from '@/utils/request'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { baseName } from './utils'
|
||||
|
||||
export async function listBannedUrls(page, authHost, token) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/media_proxy_caches?page=${page}`,
|
||||
method: 'get',
|
||||
headers: authHeaders(token)
|
||||
})
|
||||
}
|
||||
|
||||
export async function purgeUrls(urls, ban, authHost, token) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/media_proxy_caches/purge`,
|
||||
method: 'post',
|
||||
headers: authHeaders(token),
|
||||
data: { urls, ban }
|
||||
})
|
||||
}
|
||||
|
||||
export async function removeBannedUrls(urls, authHost, token) {
|
||||
return await request({
|
||||
baseURL: baseName(authHost),
|
||||
url: `/api/pleroma/admin/media_proxy_caches/delete`,
|
||||
method: 'post',
|
||||
headers: authHeaders(token),
|
||||
data: { urls }
|
||||
})
|
||||
}
|
||||
|
||||
const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
|
Loading…
Reference in a new issue