mm-math 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +4 -3
- package/package.json +1 -1
package/index.html
CHANGED
|
@@ -519,6 +519,7 @@ document.getElementById('fUser').addEventListener('keydown', e => {
|
|
|
519
519
|
});
|
|
520
520
|
|
|
521
521
|
// ── Login ─────────────────────────────────────────────────────────────────────
|
|
522
|
+
const API_BASE = window.location.hostname === 'calc.moshelab.com' ? '' : 'https://calc.moshelab.com';
|
|
522
523
|
async function doLogin() {
|
|
523
524
|
const username = document.getElementById('fUser').value.trim();
|
|
524
525
|
const password = document.getElementById('fPass').value;
|
|
@@ -535,7 +536,7 @@ async function doLogin() {
|
|
|
535
536
|
errEl.textContent = '';
|
|
536
537
|
|
|
537
538
|
try {
|
|
538
|
-
const res = await fetch('/api/login', {
|
|
539
|
+
const res = await fetch(API_BASE + '/api/login', {
|
|
539
540
|
method: 'POST',
|
|
540
541
|
headers: { 'Content-Type': 'application/json' },
|
|
541
542
|
body: JSON.stringify({ username, password }),
|
|
@@ -566,8 +567,8 @@ async function doLogin() {
|
|
|
566
567
|
} else {
|
|
567
568
|
window.location.href = './browse.html';
|
|
568
569
|
}
|
|
569
|
-
} catch {
|
|
570
|
-
errEl.textContent = '
|
|
570
|
+
} catch (err) {
|
|
571
|
+
errEl.textContent = 'Error: ' + (err && err.message ? err.message : err);
|
|
571
572
|
btn.disabled = false;
|
|
572
573
|
btn.textContent = 'Sign In';
|
|
573
574
|
}
|