palettehome/client.js
2024-04-08 10:56:01 +02:00

23 lines
910 B
JavaScript

// Define constants
const giteaBaseUrl = "https://git.deuxfleurs.fr";
const clientId = "7fff7e96-5ff6-4c16-b6dc-da431dd4f82e";
const redirectUri = "https%3A%2F%2Fpalette.web.deuxfleurs.fr%2Fcallback";
const path = './hugo.toml';
// Add event listener for the "Continuer" link click event
document.addEventListener('DOMContentLoaded', () => {
const continuerLink = document.getElementById('continuer-link');
if (continuerLink) {
continuerLink.addEventListener('click', async (event) => {
event.preventDefault();
try {
// Redirect to the login page
const loginUrl = `${giteaBaseUrl}/login/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code`;
window.location.href = loginUrl;
} catch (error) {
console.error('Error:', error);
}
});
}
});