modernize dependencies

This commit is contained in:
41666 2018-11-01 01:36:39 -05:00
parent ea51d94c16
commit 5a1fc526db
22 changed files with 8578 additions and 22658 deletions

View file

@ -12,6 +12,12 @@ class OauthCallback extends Component {
redirect: '/s'
}
stopped = false
componentDidUnmount () {
this.stopped = true
}
async componentDidMount () {
// handle stuff in the url
const sp = new URLSearchParams(this.props.location.search)
@ -25,14 +31,15 @@ class OauthCallback extends Component {
const stateToken = sp.get('state')
const state = JSON.parse(window.sessionStorage.getItem('state') || 'null')
if (state !== null && state.state === stateToken && state.redirect != undefined) {
if (state !== null && state.state === stateToken && state.redirect != null) {
this.setState({ redirect: state.redirect })
}
this.props.history.replace(this.props.location.pathname)
let counter = 0
let counter = 0
const retry = async () => {
if (this.stopped) return
try {
const rsp = await superagent.get('/api/auth/user')
this.props.dispatch({
@ -43,7 +50,7 @@ class OauthCallback extends Component {
this.setState({ notReady: false })
} catch (e) {
counter++
if (counter > 100) {
if (counter > 10) {
this.setState({ message: "i couldn't log you in. :c" })
} else {
setTimeout(() => { retry() }, 250)

View file

@ -3,16 +3,29 @@ import { DragSource } from 'react-dnd'
import Role from './index'
@DragSource(Symbol.for('dnd: role'), {
beginDrag ({ role, categoryId }) {
return { role, category: categoryId }
}
},
(connect, monitor) => ({
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
}))
export default class DraggableRole extends Component {
// @DragSource(Symbol.for('dnd: role'), {
// beginDrag ({ role, categoryId }) {
// return { role, category: categoryId }
// }
// },
// (connect, monitor) => ({
// connectDragSource: connect.dragSource(),
// isDragging: monitor.isDragging()
// }))
export default
@DragSource(
Symbol.for('dnd: role'),
{
beginDrag ({ role, categoryId }) {
return { role, category: categoryId }
}
},
(connect, monitor) => ({
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
})
)
class DraggableRole extends Component {
render () {
return <Role {...this.props} type='drag' />
}

View file

@ -12,9 +12,10 @@ import ServerLanding from '../components/servers/ServerLanding'
const aaa = (props) => (<div>{ JSON.stringify(props) }</div>)
@withRouter
@connect(({ appState, user }) => ({ ready: appState.ready, user }))
export default class AppRouter extends Component {
export default
@withRouter
@connect(({ appState, user }) => ({ ready: appState.ready, user }))
class AppRouter extends Component {
render () {
const isLoggedIn = this.props.user.get('isLoggedIn')

View file

@ -13,7 +13,7 @@ const configureStore = (preloadedState, history) => {
preloadedState,
compose(
applyMiddleware(thunk, routerMiddleware(history), createLogger()),
DevTools.instrument()
// DevTools.instrument()
)
)