Skip to content
Snippets Groups Projects
Commit dcc3aae0 authored by nicrausaz's avatar nicrausaz
Browse files

Gestion des erreurs, matu dans tableau

parent 27ed3bd7
No related branches found
No related tags found
No related merge requests found
import axios from 'axios' import axios from 'axios'
// import store from '@/store/store.js' import store from '@/store/store.js'
// import router from '@/router/index.js' import router from '@/router/index.js'
const instance = axios.create({ const instance = axios.create({
headers: { 'Authorization': "Bearer " + localStorage.getItem('stored_token') }, headers: { 'Authorization': "Bearer " + localStorage.getItem('stored_token') },
baseURL: 'https://canap-gest.epfl.ch:8443/api' baseURL: 'https://canap-gest.epfl.ch:8443/api'
}) })
// instance.interceptors.response.use(function (response) { instance.interceptors.response.use(function (response) {
// return response return response
// }, function (error) { }, function (error) {
// if (!error.response) { if (!error.response) {
// store.commit('moduleSnackbar/toggle', { open: true, message: 'API non atteignable', type: 'warning' }, { root: true }) store.commit('moduleSnackbar/toggle', { open: true, message: 'API non atteignable', type: 'warning' }, { root: true })
// } else if (error.response.status == 400 || error.response.status == 401) { } else if (error.response.status == 400 || error.response.status == 401) {
// // Erreur de token // Erreur de token
// store.commit('moduleSnackbar/toggle', { open: true, message: error.response.data.error, type: 'warning' }, { root: true }) // store.commit('moduleSnackbar/toggle', { open: true, message: error.response.data.error, type: 'warning' }, { root: true })
// store.dispatch('moduleUser/logout', false) // store.dispatch('moduleUser/logout', false)
// } else if (error.response.status == 403 || error.response.status == 404) { console.log('token is dead')
// router.push({ name: 'error', params: { status: error.response.data.error, message: error.response.data.message, route: '' } }) } else if (error.response.status == 403 || error.response.status == 404) {
// } else { router.push({ name: 'error', params: { status: error.response.data.error, message: error.response.data.message, route: '' } })
// // Affichage des erreurs (snackbar) } else {
// Object.values(error.response.data).forEach(errMsg => { // Affichage des erreurs (snackbar)
// store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true }) Object.values(error.response.data).forEach(errMsg => {
// }) store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true })
// } })
// return Promise.reject(error) }
// }) return Promise.reject(error)
})
export default instance export default instance
\ No newline at end of file
...@@ -45,6 +45,10 @@ ...@@ -45,6 +45,10 @@
<td>{{ props.item.applicant_name }} {{ props.item.applicant_fsname }}</td> <td>{{ props.item.applicant_name }} {{ props.item.applicant_fsname }}</td>
<td>{{ props.item.job_full_value }}</td> <td>{{ props.item.job_full_value }}</td>
<td>{{ props.item.location_site }}</td> <td>{{ props.item.location_site }}</td>
<td>
<span v-if="props.item.applicant_maturity">&#10004;</span>
<span v-else>&#10008;</span>
</td>
<td>{{ props.item.applicant_address_street }} {{ props.item.applicant_address_npa }}</td> <td>{{ props.item.applicant_address_street }} {{ props.item.applicant_address_npa }}</td>
<td>{{ props.item.applicant_mail }}</td> <td>{{ props.item.applicant_mail }}</td>
<td> <td>
...@@ -119,6 +123,7 @@ export default { ...@@ -119,6 +123,7 @@ export default {
{ text: 'Nom, Prénom', align: 'left', value: 'applicant_fsname' }, { text: 'Nom, Prénom', align: 'left', value: 'applicant_fsname' },
{ text: 'Formation', value: 'applicant_formation' }, { text: 'Formation', value: 'applicant_formation' },
{ text: 'Lieu', value: 'applicant_formation_location' }, { text: 'Lieu', value: 'applicant_formation_location' },
{ text: 'Maturité', value: 'applicant_maturity' },
{ text: 'Adresse', value: 'applicant_npa' }, { text: 'Adresse', value: 'applicant_npa' },
{ text: 'Email', value: 'applicant_mail' }, { text: 'Email', value: 'applicant_mail' },
{ text: 'Date naissance, majeur', value: 'applicant_birthdate' }, { text: 'Date naissance, majeur', value: 'applicant_birthdate' },
......
<template> <template>
<div id="openjobs-view"> <div id="openjobs-view">
<h1>Places ouvertes</h1> <h1>Places ouvertes</h1>
<template v-if="loaded"> <template>
<div> <div>
<v-toolbar flat color="white"> <v-toolbar flat color="white">
<v-spacer></v-spacer> <v-spacer></v-spacer>
...@@ -93,10 +93,7 @@ ...@@ -93,10 +93,7 @@
<template v-slot:items="props"> <template v-slot:items="props">
<td>{{ props.item.job_full_value }}</td> <td>{{ props.item.job_full_value }}</td>
<td>{{ props.item.location_site }}</td> <td>{{ props.item.location_site }}</td>
<td <td>{{props.item.access_groups.length}} groupe(s)</td>
v-if="props.item.access_groups.length > 1"
>{{ props.item.access_groups[0].access_group_value }} + {{props.item.access_groups.length-1}} autre(s) groupes(s)</td>
<td v-else>{{props.item.access_groups[0].access_group_value }}</td>
<td>{{ props.item.position_spot_number }}</td> <td>{{ props.item.position_spot_number }}</td>
<td> <td>
<v-icon class="mr-2" @click="editItem(props.item)">edit</v-icon> <v-icon class="mr-2" @click="editItem(props.item)">edit</v-icon>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment