Fixes bug where multiple post requests were getting called on page reload