feat(app): migrate /app accounts to Vue SPA (stage 3)
This commit is contained in:
57
app-frontend/src/api/accounts.js
Normal file
57
app-frontend/src/api/accounts.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import { publicApi } from './http'
|
||||
|
||||
export async function fetchAccounts(params = {}) {
|
||||
const { data } = await publicApi.get('/accounts', { params })
|
||||
return data
|
||||
}
|
||||
|
||||
export async function addAccount(payload) {
|
||||
const { data } = await publicApi.post('/accounts', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateAccount(accountId, payload) {
|
||||
const { data } = await publicApi.put(`/accounts/${accountId}`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteAccount(accountId) {
|
||||
const { data } = await publicApi.delete(`/accounts/${accountId}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateAccountRemark(accountId, payload) {
|
||||
const { data } = await publicApi.put(`/accounts/${accountId}/remark`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function startAccount(accountId, payload) {
|
||||
const { data } = await publicApi.post(`/accounts/${accountId}/start`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function stopAccount(accountId) {
|
||||
const { data } = await publicApi.post(`/accounts/${accountId}/stop`, {})
|
||||
return data
|
||||
}
|
||||
|
||||
export async function batchStartAccounts(payload) {
|
||||
const { data } = await publicApi.post('/accounts/batch/start', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function batchStopAccounts(payload) {
|
||||
const { data } = await publicApi.post('/accounts/batch/stop', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function clearAccounts() {
|
||||
const { data } = await publicApi.post('/accounts/clear', {})
|
||||
return data
|
||||
}
|
||||
|
||||
export async function takeScreenshot(accountId, payload = {}) {
|
||||
const { data } = await publicApi.post(`/accounts/${accountId}/screenshot`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
7
app-frontend/src/api/stats.js
Normal file
7
app-frontend/src/api/stats.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { publicApi } from './http'
|
||||
|
||||
export async function fetchRunStats() {
|
||||
const { data } = await publicApi.get('/run_stats')
|
||||
return data
|
||||
}
|
||||
|
||||
12
app-frontend/src/api/user.js
Normal file
12
app-frontend/src/api/user.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { publicApi } from './http'
|
||||
|
||||
export async function fetchVipInfo() {
|
||||
const { data } = await publicApi.get('/user/vip')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function logout() {
|
||||
const { data } = await publicApi.post('/logout', {})
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user