Errores al minificar login detectados
This commit is contained in:
parent
0e9628436e
commit
58d8176a42
|
@ -6,6 +6,7 @@ export class InputAttrsNormalizer {
|
|||
$get(){
|
||||
return {
|
||||
normalize: function(attrs) {
|
||||
// FIXME: No siempre se pasan estos atributos, ej: searchbar
|
||||
/* if (!attrs.entity)
|
||||
throw new Error(`Attribute 'entity' not defined on input`);
|
||||
if (!attrs.field)
|
||||
|
|
|
@ -5,14 +5,14 @@ import * as util from '../util';
|
|||
const _NAME = 'spinner';
|
||||
export const NAME = util.getName(_NAME);
|
||||
|
||||
directive.$inject =[resolveFactory.NAME];
|
||||
directive.$inject = [resolveFactory.NAME];
|
||||
export function directive (resolve){
|
||||
return{
|
||||
require:'E',
|
||||
template: function(_,attr){
|
||||
return resolve.getTemplate(_NAME, attr);
|
||||
restrict: 'E',
|
||||
template: function(_, attrs){
|
||||
return resolve.getTemplate(_NAME, attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_module.directive(NAME,directive);
|
||||
_module.directive(NAME, directive);
|
||||
|
|
|
@ -5,16 +5,13 @@ import style from './login.scss'
|
|||
export const COMPONENT =
|
||||
{
|
||||
template: template,
|
||||
controller: function ($http)
|
||||
{
|
||||
controller: function($http) {
|
||||
var self = this;
|
||||
this.submit = function ()
|
||||
{
|
||||
this.submit = function() {
|
||||
var model = this.model;
|
||||
|
||||
if (model && model.email && model.password)
|
||||
{
|
||||
setLoading (true);
|
||||
if(model && model.email && model.password) {
|
||||
setLoading(true);
|
||||
model.appId = window.location.href;
|
||||
$http.post('/account', this.model).then (
|
||||
onLoginOk,
|
||||
|
@ -22,25 +19,21 @@ export const COMPONENT =
|
|||
);
|
||||
}
|
||||
else
|
||||
showMessage ('Please insert your email and password');
|
||||
showMessage('Please insert your email and password');
|
||||
};
|
||||
|
||||
function onLoginOk (response)
|
||||
{
|
||||
setLoading (false);
|
||||
//sessionStorage.setItem ('token', response.data.accessToken);
|
||||
function onLoginOk (response) {
|
||||
setLoading(false);
|
||||
window.location = response.data.location +'?access_token='+ response.data.accessToken;
|
||||
}
|
||||
|
||||
function onLoginErr (response)
|
||||
{
|
||||
setLoading (false);
|
||||
function onLoginErr(response) {
|
||||
setLoading(false);
|
||||
self.model.password = '';
|
||||
|
||||
var message;
|
||||
|
||||
switch (response.status)
|
||||
{
|
||||
switch(response.status) {
|
||||
case 401:
|
||||
message = 'Invalid credentials';
|
||||
break;
|
||||
|
@ -51,28 +44,27 @@ export const COMPONENT =
|
|||
message = 'Something went wrong';
|
||||
}
|
||||
|
||||
showMessage (message);
|
||||
showMessage(message);
|
||||
}
|
||||
|
||||
function $ (id)
|
||||
{
|
||||
return document.getElementById (id);
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function setLoading (isLoading)
|
||||
{
|
||||
var spinner = $('spinner').firstChild.MaterialSpinner;
|
||||
|
||||
if (isLoading)
|
||||
spinner.start ();
|
||||
function setLoading(isLoading) {
|
||||
// FIXME: Al minimificar MaterialSpinner es undefined
|
||||
/* var spinner = $('spinner').firstChild.MaterialSpinner;
|
||||
|
||||
if(isLoading)
|
||||
spinner.start();
|
||||
else
|
||||
spinner.stop ();
|
||||
}
|
||||
spinner.stop();
|
||||
*/ }
|
||||
|
||||
function showMessage (message)
|
||||
{
|
||||
function showMessage(message) {
|
||||
// FIXME: Al minimificar no muestra la barra
|
||||
var snackbar = $('snackbar').firstChild.MaterialSnackbar;
|
||||
snackbar.showSnackbar ({message: message});
|
||||
snackbar.showSnackbar({message: message});
|
||||
}
|
||||
},
|
||||
controllerAs: 'login'
|
||||
|
|
Loading…
Reference in New Issue