mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-22 06:49:35 +00:00
[Master task, sub task] API
This commit is contained in:
1 parent
4429e3e566
commit
6e8f57d06d
11 files changed
+188
-111
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import store from '@/store'
|
||||
import toastUtils from '@/plugins/w/toast/utils/toast.utils'
|
||||
|
||||
axios.defaults.baseURL = process.env.VUE_APP_WAXIOS_URL
|
||||
|
||||
@@ -7,7 +8,7 @@ export default {
|
||||
async get(url: string, config?: any) {
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async get_auth(url: string, config?: any) {
|
||||
@@ -15,13 +16,13 @@ export default {
|
||||
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async get_data(url: string, config?: any) {
|
||||
return axios.get(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async get_auth_data(url: string, config?: any) {
|
||||
@@ -29,14 +30,14 @@ export default {
|
||||
|
||||
return axios.get(url, config)
|
||||
.then(response => Promise.resolve(response.data.data))
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async post(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async post_auth(url: string, params = null, config?: any) {
|
||||
@@ -44,14 +45,14 @@ export default {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async post_data(url: string, params = null, config?: any) {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async post_auth_data(url: string, params = null, config?: any) {
|
||||
@@ -59,13 +60,13 @@ export default {
|
||||
|
||||
return axios.post(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async delete(url: string, config?: any) {
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async delete_auth(url: string, config?: any) {
|
||||
@@ -73,13 +74,13 @@ export default {
|
||||
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async delete_data(url: string, config?: any) {
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async delete_auth_data(url: string, config?: any) {
|
||||
@@ -87,13 +88,13 @@ export default {
|
||||
|
||||
return axios.delete(url, config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async patch(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async patch_auth(url: string, params = null, config?: any) {
|
||||
@@ -101,13 +102,13 @@ export default {
|
||||
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async patch_data(url: string, params = null, config?: any) {
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async patch_auth_data(url: string, params = null, config?: any) {
|
||||
@@ -115,13 +116,13 @@ export default {
|
||||
|
||||
return axios.patch(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async put(url: string, params = null, config?: any) {
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async put_auth(url: string, params = null, config?: any) {
|
||||
@@ -129,13 +130,13 @@ export default {
|
||||
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data)
|
||||
.catch(error => Promise.reject(error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error)))
|
||||
},
|
||||
|
||||
async put_data(url: string, params = null, config?: any) {
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
async put_auth_data(url: string, params = null, config?: any) {
|
||||
@@ -143,7 +144,7 @@ export default {
|
||||
|
||||
return axios.put(url, this._objectToFormData(params), config)
|
||||
.then(response => response.data.data)
|
||||
.catch(error => Promise.reject(error.response || error))
|
||||
.catch(error => Promise.reject(toastUtils.parseAndTranslate(error.response || error)))
|
||||
},
|
||||
|
||||
_config(config: any) {
|
||||
|
||||
Reference in new issue
Block a user