feat(app): migrate schedules and screenshots (stage 4)
This commit is contained in:
42
app-frontend/src/api/schedules.js
Normal file
42
app-frontend/src/api/schedules.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import { publicApi } from './http'
|
||||
|
||||
export async function fetchSchedules() {
|
||||
const { data } = await publicApi.get('/schedules')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function createSchedule(payload) {
|
||||
const { data } = await publicApi.post('/schedules', payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function updateSchedule(scheduleId, payload) {
|
||||
const { data } = await publicApi.put(`/schedules/${scheduleId}`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteSchedule(scheduleId) {
|
||||
const { data } = await publicApi.delete(`/schedules/${scheduleId}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function toggleSchedule(scheduleId, payload) {
|
||||
const { data } = await publicApi.post(`/schedules/${scheduleId}/toggle`, payload)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function runScheduleNow(scheduleId) {
|
||||
const { data } = await publicApi.post(`/schedules/${scheduleId}/run`, {})
|
||||
return data
|
||||
}
|
||||
|
||||
export async function fetchScheduleLogs(scheduleId, params = {}) {
|
||||
const { data } = await publicApi.get(`/schedules/${scheduleId}/logs`, { params })
|
||||
return data
|
||||
}
|
||||
|
||||
export async function clearScheduleLogs(scheduleId) {
|
||||
const { data } = await publicApi.delete(`/schedules/${scheduleId}/logs`)
|
||||
return data
|
||||
}
|
||||
|
||||
17
app-frontend/src/api/screenshots.js
Normal file
17
app-frontend/src/api/screenshots.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { publicApi } from './http'
|
||||
|
||||
export async function fetchScreenshots() {
|
||||
const { data } = await publicApi.get('/screenshots')
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteScreenshot(filename) {
|
||||
const { data } = await publicApi.delete(`/screenshots/${encodeURIComponent(filename)}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function clearScreenshots() {
|
||||
const { data } = await publicApi.post('/screenshots/clear', {})
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user