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(setLoggedIn(res))
// dispatch(setWorking(false)) // dispatch(setWorking(false))
} catch (e) { } catch (e) {
console.log(e.toString())
dispatch(setError({ dispatch(setError({
type: 'password', type: 'password',
error: e.toString() error: e.toString()

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ module.exports = {
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: 'assets/templates/login.html', 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') filename: path.join(__dirname, '/.tmp/public/login.html')
}), }),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({