-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
29 lines (22 loc) · 954 Bytes
/
renderer.js
File metadata and controls
29 lines (22 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Frontend logic for the Electron app
document.addEventListener('DOMContentLoaded', async () => {
// Check if user is already logged in
const credentials = await window.secureStorage.getCredentials();
if (credentials && credentials.token && credentials.school) {
// Already logged in, redirect to dashboard
window.location.href = 'dashboard.html';
return;
}
const connectBtn = document.getElementById('connect-btn');
const tokenInput = document.getElementById('canvas-token');
const schoolLinkInput = document.getElementById('school-link');
// Button click handler
connectBtn.addEventListener('click', async () => {
const token = tokenInput.value.trim();
const schoolLink = schoolLinkInput.value.trim();
// Store credentials securely using OS keychain
await window.secureStorage.saveCredentials(token, schoolLink);
// Navigate to main app
window.location.href = 'dashboard.html';
});
});