move debounce to api

main
briandennis 7 years ago committed by Brian Dennis
parent a5f42043d3
commit f71506ffbd

@ -1,4 +1,6 @@
import axios from 'axios'
import debounce from 'lodash.debounce'
import ms from 'ms'
const DOMAIN = process.browser ? document.location.origin : ''
const RATE_LIMIT_CODE = 420
@ -54,5 +56,5 @@ function checkIfRateLimited (err) {
export default {
getGist,
tweet
tweet: debounce(tweet, ms('5s'), {leading: true, trailing: true})
}

@ -3,8 +3,6 @@ import React from 'react'
import HTML5Backend from 'react-dnd-html5-backend'
import { DragDropContext } from 'react-dnd'
import domtoimage from 'dom-to-image'
import debounce from 'lodash.debounce'
import ms from 'ms'
// Ours
import Page from '../components/Page'
@ -113,7 +111,7 @@ class Editor extends React.Component {
<div className="buttons">
<Button
className="tweetButton"
onClick={debounce(this.upload, ms('5s'), {leading: true, trailing: false})}
onClick={this.upload}
title={this.state.uploading ? 'Loading...' : 'Tweet Image'}
color="#57b5f9"
style={{ marginRight: '8px' }}

Loading…
Cancel
Save