From f71506ffbda16435a6946c5cffa8d9563e700502 Mon Sep 17 00:00:00 2001 From: briandennis Date: Fri, 22 Sep 2017 19:21:00 -0500 Subject: [PATCH] move debounce to api --- lib/api.js | 4 +++- pages/editor.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/api.js b/lib/api.js index d98ca3c..64d3849 100644 --- a/lib/api.js +++ b/lib/api.js @@ -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}) } diff --git a/pages/editor.js b/pages/editor.js index 19e3405..1bfb4e6 100644 --- a/pages/editor.js +++ b/pages/editor.js @@ -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 {