Commit fd76fe25 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch 'led/fix-404-console-error' into 'master'

Fix 404 console error when user is signed out

See merge request gitlab-org/gitlab!84361
parents 331de617 614e6d54
......@@ -4,8 +4,8 @@
= link_to s_('Nav|Home'), root_path
%li
- if current_user
= link_to s_('Nav|Sign out and sign in with a different account'), '#', id: 'sign_out_link'
%form{ action: destroy_user_session_path, method: :post, id: 'sign_out_form' }
= link_to s_('Nav|Sign out and sign in with a different account'), '#', class: 'js-sign-out-link'
%form.js-sign-out-form{ action: destroy_user_session_path, method: :post }
- else
= link_to s_('Nav|Sign In / Register'), new_session_path(:user, redirect_to_referer: 'yes')
%li
......
......@@ -22,8 +22,8 @@
}
// We do not have rails_ujs here, so we're manually making a link trigger a form submit.
document.getElementById('sign_out_link').addEventListener('click', function(e) {
document.querySelector('.js-sign-out-link')?.addEventListener('click', (e) => {
e.preventDefault();
document.getElementById('sign_out_form').submit();
document.querySelector('.js-sign-out-form')?.submit();
});
}());
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment