diff --git a/app/templates/corpora/corpus_public.html.j2 b/app/templates/corpora/corpus_public.html.j2 index caaf011a..90a45f62 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 = 'addUnfollow 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(