fix: make repo clone https/ssh listener conditional

- It's possible that either the SSH or HTTPS element does not exist.
Thus make adding the event listener conditional.
- Ref: forgejo/forgejo#7408
- Reported-by: @0ko
This commit is contained in:
Gusted 2025-04-02 19:13:50 +02:00
parent 5706a2452e
commit 4ff1288194
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -41,11 +41,11 @@ export function initRepoCloneLink() {
return;
}
repoCloneSSH.addEventListener('click', () => {
repoCloneSSH?.addEventListener('click', () => {
localStorage.setItem('repo-clone-protocol', 'ssh');
window.updateCloneStates();
});
repoCloneHTTPS.addEventListener('click', () => {
repoCloneHTTPS?.addEventListener('click', () => {
localStorage.setItem('repo-clone-protocol', 'https');
window.updateCloneStates();
});