{
test: /\.scss$/i,
loader: ExtractTextPlugin.extract(
fallback: 'style-loader',
use: `css-loader?modules&importLoader=1&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]!resolve-url-loader!sass-loader`),
include: path.resolve(__dirname, 'src')
},
include: path.resolve(__dirname, 'src')
"css-loader?modules&importLoader=1&sourceMap&localIdentName=[name]__[local]___[hash:base64:5]!resolve-url-loader!sass-loader"
class Expample extends Component {
state = {
connectionType = '',
};
handleChangeSwitch(value) {
this.setState(prevState => ({
connectionType: prevState.connectionType === value ? '' : value,
}));
}
render() {
const { connectionType } = this.state;
const switchParams = {
circleStyles: { onColor: '#4caf50', offColor: 'white' },
switchStyles: { width: 100, background: '#ccc' },
labels: { on: 'ВКЛ', off: 'ВЫКЛ' },
};
return (
<Wrapper>
<Switch
{...switchParams}
value={connetcionType === 'WiFi'}
onChange={() => handleChangeSwitch('WiFi')}
/>
<Switch
{...switchParams}
value={connetcionType === 'BT'}
onChange={() => handleChangeSwitch('BT')}
/>
</Wrapper>
);
}
}
const loginError = data => ({
type: LOGIN_ERROR,
payload: data,
});
case LOGIN_ERROR:
return {
...state,
errorMessage: payload,
isLoading: false,
isError: true,
};
const initialState = {
isLoading: false,
isError: false,
shouldRedirect: false,
errorMessage: '',
};
case LOGIN_REQUEST:
return {
...state,
isLoading: true,
isError: false,
errorMessage: '',
};
const { isLoading, isError, shouldRedirect, errorMessage } = this.props;
if (shouldRedirect) <Redirect to="/index" >;
render (
...
{isError && <ErrorMessage message={errorMessage} />}
...
);
try {
const res = await axios.post('/api/user', form);
dispatch(loginSuccess());
} catch e {
dispatch(loginError(e.responce.data));
}
install babel-polyfill --save
module.exports = {
entry: ["babel-polyfill", __dirname + "/public/js/index.js"],