diff --git a/src/static/swagger/custom_button.js b/custom_button.js similarity index 100% rename from src/static/swagger/custom_button.js rename to custom_button.js diff --git a/src/static/custom_button.js b/src/static/custom_button.js new file mode 100644 index 00000000..d15c01bc --- /dev/null +++ b/src/static/custom_button.js @@ -0,0 +1,30 @@ +window.addEventListener("load", function () { + + var base_url = window.location.origin + + var login_button = document.createElement('button') + login_button.innerHTML = 'Log in' + login_button.classList.add('btn', 'authorize') + login_button.onclick = function () { + window.location.href = base_url + '/logto/sign-in' + } + + var user_button = document.createElement('button') + user_button.innerHTML = 'User info' + user_button.classList.add('btn', 'authorize') + user_button.onclick = function () { + window.location.href = base_url + '/user' + } + + var logout_button = document.createElement('button') + logout_button.innerHTML = 'Log out' + logout_button.classList.add('btn', 'authorize') + logout_button.onclick = function () { + window.location.href = base_url + '/logto/sign-out' + } + + var auth_pan = document.getElementsByClassName('auth-wrapper')[0] + auth_pan.appendChild(login_button) + auth_pan.appendChild(user_button) + auth_pan.appendChild(logout_button) +}) \ No newline at end of file