Skip to content

Commit

Permalink
fix: Move custom_button.js script into static root (#261)
Browse files Browse the repository at this point in the history
* fix: Add static files to the dist folder

* fix: small fix with path to copy

* fix: Skip API guarding for .js files

* Move to path.join for static files

* Move to relative path

* Add explicit file for static

* Move static js script from swagger to static root
  • Loading branch information
Andrew Nikitin authored Jun 13, 2023
1 parent b06a826 commit 8544020
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
File renamed without changes.
30 changes: 30 additions & 0 deletions src/static/custom_button.js
Original file line number Diff line number Diff line change
@@ -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)
})

0 comments on commit 8544020

Please sign in to comment.