mirror of
https://github.com/crater-invoice/crater.git
synced 2026-02-10 21:02:41 -05:00
build version 400
This commit is contained in:
41
resources/assets/js/store/modules/backup/actions.js
Normal file
41
resources/assets/js/store/modules/backup/actions.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import * as types from './mutation-types'
|
||||
|
||||
export const fetchBackups = ({ commit, dispatch, state }, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios
|
||||
.get(`/api/v1/backups`, { params })
|
||||
.then((response) => {
|
||||
commit(types.SET_BACKUPS, response.data)
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const createBackup = ({ commit, dispatch, state }, data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios
|
||||
.post(`/api/v1/backups`, data)
|
||||
.then((response) => {
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const removeBackup = ({ commit, dispatch, state }, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
window.axios
|
||||
.delete(`/api/v1/backups/${params.disk}`, { params })
|
||||
.then((response) => {
|
||||
resolve(response)
|
||||
})
|
||||
.catch((err) => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user