This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { BrowserRouter } from 'react-router-dom'; | |
// "react-router": "^5.1.2" | |
// "react-router-dom": "^5.1.2" | |
<BrowserRouter | |
getUserConfirmation={(message, callback) => ( | |
CustomPromptComponent(message, callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am matijagalina on github. | |
* I am mgalina (https://keybase.io/mgalina) on keybase. | |
* I have a public key ASCgRLvrkyavuERNgj8WUiwtSh6wurbRz5fYaPmdAMMKKAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
axios.defaults.xsrfCookieName = 'csrftoken'; | |
axios.defaults.xsrfHeaderName = 'x-csrftoken'; | |
axios.interceptors.response.use((response) => { | |
if (response.status === 401 | |
|| response.status === 403) { | |
window.location.href = '/login'; // eslint-disable-line no-undef | |
} | |
return response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { connect } from 'react-redux'; | |
import get from 'lodash.get'; | |
import ProfileDetails from '../components/ProfileDetails'; | |
import { refreshUser } from 'redux/user/actions'; | |
const ProfileContainer = ({ | |
refreshUserAction, | |
user, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
mode: 'development', | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.js', | |
}, | |
module: { | |
rules: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// boilerplate for HOC | |
// import React, { Component } from "react"; | |
// export default ChildComponent => { | |
// class ComposedComponent extends Component { | |
// render() { | |
// // pass the props | |
// return <ChildComponent {...this.props} /> | |
// } | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// boilerplate for middleware | |
export default ({ dispatch }) => next => action => { | |
// add new property on action object | |
const newAction = { ...action, test: 'test' }; | |
// condition to skip this middleware | |
const somethingWrong = false; | |
if(somethingWrong) { | |
// call next middleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { applyMiddleware, combineReducers, createStore } from 'redux'; | |
import thunk from 'redux-thunk'; | |
import App from './components/App'; | |
import api from '../api'; | |
// asynchronous action using async/await syntax | |
const getUser = () => async dispatch => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { Provider } from 'react-redux'; | |
import { combineReducers, createStore } from 'redux'; | |
import App from './components/App'; | |
const userData = { firstname: 'Pham', lastname: 'Nuwem' }; | |
// action | |
const getUser = () => ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
"eslintConfig": { | |
"extends": [ | |
"airbnb" | |
], | |
"rules": { | |
"comma-dangle": 1, | |
"import/no-unresolved": 0, |
NewerOlder