diff --git a/app/templates/corpora/corpus_public.html.j2 b/app/templates/corpora/corpus_public.html.j2 index caaf011a3d42ecf5a532fe23aedd847fff8c7d3b..90a45f6207f9c9d4cd9acec4abc984c0b2b4005e 100644 --- a/app/templates/corpora/corpus_public.html.j2 +++ b/app/templates/corpora/corpus_public.html.j2 @@ -67,9 +67,7 @@ followingUserList.add({{ following_users|tojson }}); #} corpusFollowingRequest.addEventListener('click', () => { - corpusFollowingRequest.innerHTML = '<i class="material-icons left">add</i>Unfollow Corpus'; - if ("{{ current_user.is_following_corpus(corpus) }}" === "False") { - corpusFollowingRequest.lastChild.textContent = 'Unfollow Corpus'; + if ({{ current_user.is_following_corpus(corpus)|tojson }}) { return new Promise((resolve, reject) => { fetch(`/corpora/{{ corpus.hashid }}/unfollow`, {method: 'POST', headers: {Accept: 'application/json'}}) .then(