mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Master task, sub task] API
This commit is contained in:
1 parent
4429e3e566
commit
6e8f57d06d
11 files changed
+158
-81
No files matched your search
Generated
+7
-7
@@ -18,7 +18,7 @@
|
||||
"@vuelidate/core": "^2.0.0",
|
||||
"@vuelidate/validators": "^2.0.0",
|
||||
"@vuepic/vue-datepicker": "^3.6.0",
|
||||
"@vueup/vue-quill": "^1.0.1",
|
||||
"@vueup/vue-quill": "^1.0.0-beta.11",
|
||||
"axios": "^1.1.3",
|
||||
"axios-auth-refresh": "^3.3.4",
|
||||
"core-js": "^3.8.3",
|
||||
@@ -3481,9 +3481,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vueup/vue-quill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
||||
"version": "1.0.0-beta.11",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||
"dependencies": {
|
||||
"quill": "^1.3.7",
|
||||
"quill-delta": "^4.2.2"
|
||||
@@ -16417,9 +16417,9 @@
|
||||
}
|
||||
},
|
||||
"@vueup/vue-quill": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.1.tgz",
|
||||
"integrity": "sha512-/VJHwUxH2BAms7gwIlNhHb0KfCqn/58onOK1H0ZZX9juEha4nrb32yZbv2xLsqLxf+JKsNbJgQ8Ne6VF8ACNGw==",
|
||||
"version": "1.0.0-beta.11",
|
||||
"resolved": "https://registry.npmjs.org/@vueup/vue-quill/-/vue-quill-1.0.0-beta.11.tgz",
|
||||
"integrity": "sha512-TeCgXPyVbN5muBPKm3EZjmIg/s8R8O0YmTp0RRG4J48skJVe035scLjeWZTDVrt/TEagmzcRUcB+9nPIyvF9fQ==",
|
||||
"requires": {
|
||||
"quill": "^1.3.7",
|
||||
"quill-delta": "^4.2.2"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
"@vuelidate/core": "^2.0.0",
|
||||
"@vuelidate/validators": "^2.0.0",
|
||||
"@vuepic/vue-datepicker": "^3.6.0",
|
||||
"@vueup/vue-quill": "^1.0.1",
|
||||
"@vueup/vue-quill": "^1.0.0-beta.11",
|
||||
"axios": "^1.1.3",
|
||||
"axios-auth-refresh": "^3.3.4",
|
||||
"core-js": "^3.8.3",
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
<Z-task-modal ref="z-task-modal" @on-task-edited="onTaskEdited" />
|
||||
<Z-delete-task-modal ref="z-delete-task-modal" @on-task-deleted="onTaskDeleted" />
|
||||
<Z-delete-master-task-modal ref="z-delete-master-task-modal" />
|
||||
<Z-delete-master-task-modal ref="z-delete-master-task-modal" @on-master-task-deleted="onMasterTaskDeleted" />
|
||||
<Z-complete-task-modal ref="z-complete-task-modal" @task-completed="onTaskCompleted" />
|
||||
<Z-task-add-time-modal ref="z-task-add-time-modal" />
|
||||
<Z-blocker-modal ref="z-blocker-modal" />
|
||||
|
||||
<Z-master-task-modal ref="z-master-task-modal" />
|
||||
<Z-master-task-modal ref="z-master-task-modal" @master-task-edited="onMasterTaskEdited" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -59,8 +59,8 @@ export default {
|
||||
this.$refs['z-delete-master-task-modal'].showModal(masterTask)
|
||||
})
|
||||
|
||||
this.$events.on('show-task-modal', ({task, editMode}) => {
|
||||
this.$refs['z-task-modal'].showModal(task, editMode)
|
||||
this.$events.on('show-task-modal', ({task, editMode, masterTask}) => {
|
||||
this.$refs['z-task-modal'].showModal(task, editMode, masterTask)
|
||||
})
|
||||
|
||||
this.$events.on('show-master-task-modal', ({masterTask, editMode}) => {
|
||||
@@ -78,7 +78,6 @@ export default {
|
||||
this.$events.on('show-task-add-time-modal', ({task}) => {
|
||||
this.$refs['z-task-add-time-modal'].showModal(task)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -100,6 +99,10 @@ export default {
|
||||
|
||||
onMasterTaskDeleted(masterTask){
|
||||
this.$events.emit('on-master-task-deleted', masterTask)
|
||||
},
|
||||
|
||||
onMasterTaskEdited(masterTask){
|
||||
this.$events.emit('on-master-task-edited', masterTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,3 +78,7 @@ input[type="time"]::-webkit-calendar-picker-indicator
|
||||
.rich-text-editor
|
||||
.ql-tooltip
|
||||
left: 0 !important
|
||||
|
||||
.v-toast,
|
||||
.v-toast__item
|
||||
z-index: 10000 !important
|
||||
@@ -22,8 +22,8 @@
|
||||
.v-field
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0)
|
||||
|
||||
.error .v-field
|
||||
border-bottom: 1px solid red
|
||||
// .error .v-field
|
||||
// border-bottom: 1px solid red
|
||||
|
||||
@media screen and (max-width: 904px)
|
||||
.auth-card
|
||||
@@ -48,15 +48,6 @@
|
||||
box-shadow: none !important
|
||||
border: 1px solid rgba(0, 0, 0, .1) !important
|
||||
|
||||
.auth-card .error .v-field
|
||||
border: .5px solid red !important
|
||||
|
||||
.error .v-field
|
||||
border: .5px solid red !important
|
||||
|
||||
.error .dp__input
|
||||
border: .5px solid red !important
|
||||
|
||||
.v-input__append
|
||||
margin: 0 !important
|
||||
|
||||
@@ -78,5 +69,10 @@ input::-webkit-inner-spin-button
|
||||
.v-select .v-field--variant-solo
|
||||
border: none !important
|
||||
|
||||
.error .dp__input,
|
||||
.v-input.error .v-input__control,
|
||||
.rich-text-editor.error
|
||||
border: 1px solid red !important
|
||||
|
||||
.v-messages__message
|
||||
color: red !important
|
||||
@@ -86,7 +86,8 @@ export default {
|
||||
background: unset
|
||||
&:deep(.fc-day-today)
|
||||
background: white
|
||||
a
|
||||
|
||||
.fc-daygrid-day-top a
|
||||
background: #3700B3
|
||||
width: 28px
|
||||
color: white
|
||||
|
||||
@@ -76,6 +76,16 @@ export default {
|
||||
this._getData()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||
this.masterTasks = this.masterTasks.filter(mt => mt.id != masterTask.id)
|
||||
})
|
||||
|
||||
this.$events.on('on-master-task-edited', (masterTask) => {
|
||||
this._getData()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
async _getData() {
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-select
|
||||
v-model="masterTask.project_id"
|
||||
v-model="projectCodeSelect"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Kód projektu"
|
||||
@@ -61,15 +61,15 @@
|
||||
class="modal-input mt-5"
|
||||
variant="solo"
|
||||
type="number"
|
||||
:value="totalHours"
|
||||
disabled
|
||||
:label="totalHours + ' h'"
|
||||
:label="`${masterTask.duration} h`"
|
||||
></v-text-field>
|
||||
|
||||
<v-select
|
||||
v-model="teamSelect"
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
:class="{ error: v$.masterTask.team.$errors.length }"
|
||||
label="Tím"
|
||||
variant="solo"
|
||||
:items="teams"
|
||||
@@ -81,14 +81,15 @@
|
||||
v-for="(employee, index) in masterTask.employees"
|
||||
:key="employee.id"
|
||||
@focus="onInputFocus"
|
||||
:class="{ error: masterTask.employees[index].hours < 0 }"
|
||||
:class="{ error: !masterTask.employees[index].duration }"
|
||||
class="modal-input"
|
||||
:label="`${employee.name} ${employee.surname}`"
|
||||
variant="solo"
|
||||
placeholder="h"
|
||||
v-model="masterTask.employees[index].hours"
|
||||
v-model="masterTask.employees[index].duration"
|
||||
type="number"
|
||||
min="1"
|
||||
@input="onEmployeeDurationChanged"
|
||||
>
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
@@ -110,17 +111,20 @@
|
||||
|
||||
<div class="w-100 modal-input">
|
||||
<QuillEditor
|
||||
ref="description"
|
||||
v-model="masterTask.description"
|
||||
placeholder="Popis"
|
||||
theme="snow"
|
||||
class="rich-text-editor"
|
||||
:class="{ error: v$.masterTask.deadline.$errors.length }"
|
||||
@input="masterTask.description = $event.srcElement.innerHTML"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Z-files-upload class="mt-15 files" @files-uploaded="filesUploaded"/>
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary" @click="save()">VYTVORIŤ</v-btn>
|
||||
<v-btn class="button primary" @click="save()">{{ masterTask.id ? 'ULOŽIŤ' : 'VYTVORIŤ'}}</v-btn>
|
||||
</v-card>
|
||||
|
||||
<v-card v-else height="100%" class="d-flex flex-column scrolling">
|
||||
@@ -194,7 +198,7 @@
|
||||
</v-col>
|
||||
<v-col cols="7">
|
||||
<v-sheet class="d-flex flex-wrap flex-column">
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team.name }}</p>
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ masterTask.team?.name }}</p>
|
||||
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="(employee, index) in masterTask.employees" :key="employee.id">
|
||||
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
|
||||
@@ -287,7 +291,7 @@
|
||||
<td class="task-action">
|
||||
<div class="d-flex justify-start">
|
||||
<img class="pencil-icon" :src="require('@/plugins/tm@dashboard/_components/_img/checkmark.svg')" alt="checkmark-icon" :style="{opacity: 0.3}">
|
||||
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
|
||||
<img class="pencil-icon ml-2" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="openEditTaskModal(task)">
|
||||
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)">
|
||||
</div>
|
||||
</td>
|
||||
@@ -321,7 +325,7 @@ import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
const atLeastOne = (value) => value.length
|
||||
|
||||
export default {
|
||||
emits: ['close'],
|
||||
emits: ['master-task-edited', 'close'],
|
||||
mixins: [VuetifyFixFocusMixin],
|
||||
|
||||
components: {
|
||||
@@ -342,6 +346,7 @@ export default {
|
||||
projects: null,
|
||||
employees: null,
|
||||
employeeSelect: null,
|
||||
projectCodeSelect: null,
|
||||
teamSelect: '',
|
||||
masterTask: null,
|
||||
|
||||
@@ -367,6 +372,10 @@ export default {
|
||||
this.$events.on('on-master-task-deleted', (masterTask) => {
|
||||
if (masterTask?.id == this.masterTask?.id) this.closeModal()
|
||||
})
|
||||
|
||||
this.$events.on('on-task-deleted', (task) => {
|
||||
this.masterTask.subtasks = this.masterTask.subtasks.filter(subtask => subtask.id != task.id)
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -388,10 +397,12 @@ export default {
|
||||
|
||||
|
||||
async showModal(masterTask, editMode = false) {
|
||||
this.v$.$reset()
|
||||
this.visible = true
|
||||
this.masterTask = null
|
||||
this.teamSelect = null
|
||||
this.employeeSelect = null
|
||||
this.projectCodeSelect = null
|
||||
|
||||
try {
|
||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||
@@ -401,28 +412,27 @@ export default {
|
||||
|
||||
if (masterTask?.id) {
|
||||
this.masterTask = await this.$axios.get_auth_data(`v1/mastertasks/${masterTask.id}`)
|
||||
|
||||
const project = this.projects.find(project => project.code == this.masterTask?.project_code)
|
||||
this.teamSelect = this.masterTask.team.id
|
||||
this.projectCodeSelect = project.id
|
||||
this.masterTask.project_id = project.id
|
||||
} else {
|
||||
this.masterTask = {team: {}, employees: []}
|
||||
this.masterTask = {team: {}, employees: [], duration: 0}
|
||||
}
|
||||
|
||||
this.editMode = (editMode || !this.masterTask.id)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate()))
|
||||
return
|
||||
return console.log(this.v$)
|
||||
|
||||
try {
|
||||
this.masterTask.duration = 5
|
||||
this.masterTask.description = 'popis'
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
employee.duration = 5
|
||||
return employee
|
||||
})
|
||||
this.masterTask.deadline = moment(this.masterTask.deadline).format("YYYY-MM-DD HH:MM:SS")
|
||||
|
||||
if (this.masterTask.id)
|
||||
@@ -431,6 +441,7 @@ export default {
|
||||
else
|
||||
await this.$axios.post_auth_data('v1/mastertasks', this.masterTask)
|
||||
|
||||
this.$emit('master-task-edited', this.masterTask)
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
@@ -450,6 +461,10 @@ export default {
|
||||
this.$events.emit('show-delete-task-modal', { task })
|
||||
},
|
||||
|
||||
openEditTaskModal(task) {
|
||||
this.$events.emit('show-task-modal', { task, editMode: false })
|
||||
},
|
||||
|
||||
employeeSelected(selectedOption) {
|
||||
const employee = this.employees.find((empl) => empl.id == selectedOption.key)
|
||||
this.masterTask.employees.push(employee)
|
||||
@@ -461,8 +476,26 @@ export default {
|
||||
},
|
||||
|
||||
addTask() {
|
||||
this.$events.emit('show-task-modal', {})
|
||||
this.$events.emit('show-task-modal', {task: null, editMode: false, masterTask: this.masterTask})
|
||||
},
|
||||
|
||||
onEmployeeDurationChanged() {
|
||||
let totalDuration = 0
|
||||
|
||||
this.masterTask.employees = this.masterTask.employees.map(employee => {
|
||||
if (typeof employee.duration == 'string') {
|
||||
totalDuration += parseInt(employee.duration)
|
||||
employee.duration = parseInt(employee.duration)
|
||||
}
|
||||
else if (typeof employee.duration == 'number') {
|
||||
totalDuration += employee.duration
|
||||
}
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
this.masterTask.duration = totalDuration
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -498,7 +531,9 @@ export default {
|
||||
if (!value || !this.masterTask) return
|
||||
|
||||
this.masterTask.team = this.teams.find(team => team.id == value)
|
||||
this.masterTask.team_id = this.masterTask.team.id
|
||||
this.masterTask.employees = this.masterTask.team.employees
|
||||
this.$nextTick(() => this.v$.$reset())
|
||||
},
|
||||
|
||||
employeeSelect(value) {
|
||||
@@ -510,9 +545,17 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
this.employeeSelect = null
|
||||
this.$el.activeElement.blur()
|
||||
// console.log(this.$refs['employee-select'])
|
||||
// this.$refs['employee-select'].focused = false
|
||||
// this.employeeSelect = ''
|
||||
})
|
||||
},
|
||||
|
||||
projectCodeSelect(value) {
|
||||
if (!value || !this.masterTask) return
|
||||
this.masterTask.project_id = value
|
||||
},
|
||||
|
||||
editMode() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs['description']?.setHTML(this.masterTask.description || '')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
@focus="onInputFocus"
|
||||
class="modal-input border-select"
|
||||
label="Priradený"
|
||||
:class="{ error: v$.task.employee_id.$errors.length }"
|
||||
variant="solo"
|
||||
:items="employees"
|
||||
item-value="id"
|
||||
@@ -413,9 +414,9 @@ export default {
|
||||
return {
|
||||
task: {
|
||||
date: { required },
|
||||
// team: { required },
|
||||
// team_id: { required },
|
||||
duration: { required },
|
||||
employee: { required },
|
||||
employee_id: { required },
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -427,21 +428,28 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(task, editMode = false) {
|
||||
async showModal(task, editMode = false, masterTask = null) {
|
||||
this.v$.$reset()
|
||||
this.visible = true
|
||||
this.task = null
|
||||
this.employeeIdSelect = null
|
||||
this.masterTaskIdSelect = null
|
||||
|
||||
try {
|
||||
this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks')
|
||||
|
||||
if (task?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
|
||||
t.master_task = this.masterTasks.find(mt => mt.id == t.master_task_id)
|
||||
t.employee = t.master_task.employees.find(e => t.employee_id == e.id)
|
||||
|
||||
this.employeeIdSelect = t.employee.id
|
||||
this.masterTaskIdSelect = t.master_task.id
|
||||
this.task = t
|
||||
this.task.spent_time = ((t.spent_time) / 3600000).toFixed(2)
|
||||
} else {
|
||||
this.task = {master_task: {}}
|
||||
this.task = {master_task: masterTask}
|
||||
this.masterTaskIdSelect = masterTask ? masterTask.id : null
|
||||
}
|
||||
|
||||
this.editMode = (editMode || !this.task.id)
|
||||
@@ -455,14 +463,15 @@ export default {
|
||||
},
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return console.log(this.v$)
|
||||
if (!(await this.v$.$validate()))
|
||||
return
|
||||
|
||||
try {
|
||||
if (this.task.id) {
|
||||
await this.$axios.put_auth(`v1/mastertasks/${this.task.id}`, this.task)
|
||||
if (this.task?.id) {
|
||||
await this.$axios.put_auth(`v1/mastertasks/subtasks/${this.task.id}`, this.task)
|
||||
this.$events.emit('on-task-edited', this.task)
|
||||
} else {
|
||||
await this.$axios.post_auth('v1/subtasks', this.task)
|
||||
await this.$axios.post_auth(`v1/mastertasks/${this.task.master_task.id}/subtasks`, this.task)
|
||||
}
|
||||
|
||||
this.closeModal()
|
||||
@@ -510,6 +519,7 @@ export default {
|
||||
if (!value || !this.task) return
|
||||
|
||||
this.task.employee = this.task.master_task.employees.find(employee => employee.id == value)
|
||||
this.task.employee_id = value
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,34 +1,43 @@
|
||||
import { $t } from '@/plugins/app/_config/main'
|
||||
|
||||
export default {
|
||||
parseAndTranslate(data) {
|
||||
const errorsArray = this._parseToArrayOfStrings(data)
|
||||
|
||||
return errorsArray.map(error => this._translate(error))
|
||||
|
||||
// console.log(errorsArray.map(error => $t(error)))
|
||||
return errorsArray.join(', ')
|
||||
|
||||
// return errorsArray.map(error => $t(error))
|
||||
},
|
||||
|
||||
_parseToArrayOfStrings(data) {
|
||||
if (typeof data == 'string') {
|
||||
return [this._translate(data)]
|
||||
return [$t(data)]
|
||||
}
|
||||
|
||||
if (data?.response?.data)
|
||||
return Object.values(data?.response?.data)
|
||||
|
||||
if (data && data.error && typeof data.error == 'string') {
|
||||
return [this._translate(data.error)]
|
||||
return [$t(data.error)]
|
||||
}
|
||||
|
||||
if (data && data.error && typeof data.error == 'object') {
|
||||
return Object.values(this._translate(data.error))
|
||||
return Object.values($t(data.error))
|
||||
}
|
||||
|
||||
if (data.data && data.data.error && typeof data.data.error == 'string') {
|
||||
return [this._translate(data.data.error)]
|
||||
return [$t(data.data.error)]
|
||||
}
|
||||
|
||||
if (data && data.data && data.data.error && typeof data.data.error == 'object') {
|
||||
return Object.values(data.data.error).map(error => this._translate(error[0]) + ' ')
|
||||
return Object.values(data.data.error).map(error => $t(error[0]) + ' ')
|
||||
|
||||
}
|
||||
|
||||
if (data.statusText) {
|
||||
return [this._translate(data.statusText)]
|
||||
return [$t(data.statusText)]
|
||||
}
|
||||
|
||||
return [data]
|
||||
|
||||
@@ -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