From b9dcaa1b18dfe69929b2cd24fc26ba8a75f29c97 Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Thu, 10 Oct 2019 16:24:35 -0400 Subject: [PATCH] Fixed issue with return to cookie (#828) --- app/assets/javascripts/header.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/header.js b/app/assets/javascripts/header.js index 842af35a..a32f611a 100644 --- a/app/assets/javascripts/header.js +++ b/app/assets/javascripts/header.js @@ -17,7 +17,9 @@ $(document).on('turbolinks:load', function(){ // Stores the current url when the user clicks the sign in button $(".sign-in-button").click(function(){ - var url = [location.protocol, '//', location.host, location.pathname].join(''); + var url = location.href + // Add the slash at the end if it's missing + url += url.endsWith("/") ? "" : "/" document.cookie ="return_to=" + url })