Eliminados métodos no usados y agregado método para opciones de login segun urlRol
This commit is contained in:
parent
79bdb04ce2
commit
dbdb97a78e
1 changed files with 22 additions and 22 deletions
44
resources/js/store/modules/login.js
vendored
44
resources/js/store/modules/login.js
vendored
|
@ -40,15 +40,6 @@ const actions = {
|
|||
};
|
||||
|
||||
const getters = {
|
||||
adminUrl() {
|
||||
return window.location.pathname.startsWith('/admin');
|
||||
},
|
||||
mensajes() {
|
||||
return {
|
||||
mensaje: `Contraseña de ${getters.adminUrl() ? 'administración ' : ''}del barrio`,
|
||||
ayuda: `Si no la sabés, consultá a ${getters.adminUrl() ? 'la comisión informática ' : 'tus compañerxs'}.`
|
||||
};
|
||||
},
|
||||
urlRol() {
|
||||
let split = window.location.pathname
|
||||
.replace('login', '')
|
||||
|
@ -56,19 +47,6 @@ const getters = {
|
|||
.filter(x => x.length);
|
||||
return split[0] ?? 'pedido';
|
||||
},
|
||||
titulos() {
|
||||
let rol = getters.urlRol();
|
||||
switch (rol) {
|
||||
case 'admin':
|
||||
return { titulo: "Administración de Pedidos MPS", subtitlo: "administración de pedidos" };
|
||||
case 'compras':
|
||||
return { titulo: "Comisiones MPS", subtitlo: "página de comisiones" };
|
||||
case 'pedido':
|
||||
return { titulo: "Pedidos MPS", subtitlo: "aplicación de pedidos" };
|
||||
default:
|
||||
throw new Error("Url inválida");
|
||||
}
|
||||
},
|
||||
textos() {
|
||||
let rol = getters.urlRol();
|
||||
switch (rol) {
|
||||
|
@ -125,6 +103,28 @@ const getters = {
|
|||
throw new Error("Url inválida");
|
||||
}
|
||||
},
|
||||
opcionesLogin() {
|
||||
let rol = getters.urlRol();
|
||||
switch (rol) {
|
||||
case 'admin':
|
||||
return [
|
||||
{ nombre: "Pedidos", href: "/" },
|
||||
{ nombre: "Compras", href: "/compras" }
|
||||
];
|
||||
case 'compras':
|
||||
return [
|
||||
{ nombre: "Pedidos", href: "/" },
|
||||
{ nombre: "Administración", href: "/admin" }
|
||||
];
|
||||
case 'pedido':
|
||||
return [
|
||||
{ nombre: "Administración", href: "/admin" },
|
||||
{ nombre: "Compras", href: "/compras" }
|
||||
];
|
||||
default:
|
||||
throw new Error("Url inválida");
|
||||
}
|
||||
},
|
||||
nombre() {
|
||||
return `${state.grupo_de_compra_elegido}${ getters.urlRol() === 'admin' ? '_admin' : ''}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue