Spaces:
Building
Building
Update static/js/project.js
Browse files- static/js/project.js +23 -0
static/js/project.js
CHANGED
@@ -178,3 +178,26 @@ function saveAPI() {
|
|
178 |
.then(() => alert('API updated!'))
|
179 |
.catch(() => alert('Failed to update API.'));
|
180 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
.then(() => alert('API updated!'))
|
179 |
.catch(() => alert('Failed to update API.'));
|
180 |
}
|
181 |
+
|
182 |
+
function login() {
|
183 |
+
const username = document.getElementById('usernameInput').value;
|
184 |
+
const password = document.getElementById('passwordInput').value;
|
185 |
+
|
186 |
+
fetch('/auth/login', {
|
187 |
+
method: 'POST',
|
188 |
+
headers: { 'Content-Type': 'application/json' },
|
189 |
+
body: JSON.stringify({ username, password })
|
190 |
+
})
|
191 |
+
.then(response => {
|
192 |
+
if (response.ok) {
|
193 |
+
document.getElementById('loginPanel').style.display = 'none';
|
194 |
+
document.getElementById('mainPanel').style.display = 'block';
|
195 |
+
loadProjectDetails();
|
196 |
+
} else {
|
197 |
+
document.getElementById('loginError').style.display = 'block';
|
198 |
+
}
|
199 |
+
})
|
200 |
+
.catch(() => {
|
201 |
+
document.getElementById('loginError').style.display = 'block';
|
202 |
+
});
|
203 |
+
}
|