All
This commit is contained in:
@@ -41,13 +41,41 @@ const app = createApp({
|
||||
})
|
||||
const data = await res.json()
|
||||
this.puestos.push(data)
|
||||
// order by puesto.nombre
|
||||
this.puestos.sort((a: Puesto, b: Puesto) => a.nombre.localeCompare(b.nombre))
|
||||
} catch (error) {
|
||||
alert(`Error: ${error}`)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
async actualizarPuesto(puesto_id: number, materias: Materia[], usuario_id: number) {
|
||||
to_delete: null as Puesto | null,
|
||||
async eliminarPuesto(puesto_id: number) {
|
||||
try {
|
||||
const res = await fetch('action/puesto.php', {
|
||||
method: 'DELETE',
|
||||
body: JSON.stringify({
|
||||
puesto_id
|
||||
})
|
||||
})
|
||||
const data = await res.json()
|
||||
this.message = data.msg;
|
||||
|
||||
// after 3 seconds, remove the message
|
||||
setTimeout(() => {
|
||||
this.message = null
|
||||
}, 3000)
|
||||
|
||||
this.puestos = this.puestos.filter((p: Puesto) => p.puesto_id !== puesto_id)
|
||||
// order by puesto.nombre
|
||||
this.puestos.sort((a: Puesto, b: Puesto) => a.nombre.localeCompare(b.nombre))
|
||||
} catch (error) {
|
||||
alert(`Error: ${error}`)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
async actualizarPuesto(puesto_id: number, materias: Materia[], usuario_id: number | null) {
|
||||
try {
|
||||
const res = await fetch('action/puesto.php', {
|
||||
method: 'PUT',
|
||||
|
||||
Reference in New Issue
Block a user