handle error better

pull/9/head
unknown 2018-10-29 19:35:27 -04:00
parent 385d3ed169
commit bc5485fbbc
6 changed files with 10 additions and 7 deletions

View File

@ -77,7 +77,6 @@ export const checkPassword = (email, password) => async (dispatch, getState) =>
dispatch(setLoggedIn(res))
// dispatch(setWorking(false))
} catch (e) {
console.log(e.toString())
dispatch(setError({
type: 'password',
error: e.toString()

View File

@ -88,6 +88,9 @@ export default class Ajax {
if (xhr.status === 405) {
reject(new AjaxError('405 Method Not Allowed', data, xhr))
return
} else if (xhr.status === 404) {
reject(new AjaxError('404 Not Found', data, xhr))
return
}
try {

View File

@ -6,7 +6,6 @@ import Progress from './components/Progress'
import Carousel, {CarouselItem} from './containers/Carousel'
import UnderlineInput from './components/UnderlineInput'
import reducer from './reducers/login'
import {setEmail, setPassword, setCarousel, checkEmail, checkPassword} from './actions/login'
import STYLE from '../styles/login.scss'

View File

@ -33,6 +33,10 @@ const reducer = (state = {}, action) => {
return {
emailError: data.error
}
case 'password':
return {
passwordError: data.error
}
default: return {}
}
case Actions.clear_error:

View File

@ -64,7 +64,5 @@ module.exports.http = {
// var middlewareFn = skipper({ strict: true });
// return middlewareFn;
// })(),
},
};
}
}

View File

@ -31,7 +31,7 @@ module.exports = {
plugins: [
new HtmlWebpackPlugin({
template: 'assets/templates/login.html',
links: [{ rel: 'stylesheet', type: 'text/css', href: 'login.css' }],
links: process.env.NODE_ENV === 'production' ? [{ rel: 'stylesheet', type: 'text/css', href: 'login.css' }] : [],
filename: path.join(__dirname, '/.tmp/public/login.html')
}),
new MiniCssExtractPlugin({