mm-math 0.0.2 → 0.0.4

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.
Files changed (3) hide show
  1. package/api.js +1 -0
  2. package/index.html +4 -4
  3. package/package.json +1 -1
package/api.js CHANGED
@@ -15,6 +15,7 @@ const sessions = new Map();
15
15
 
16
16
  app.set('trust proxy', 1);
17
17
  app.use(express.json({ limit: '1mb' }));
18
+ app.use(express.urlencoded({ extended: false }));
18
19
 
19
20
 
20
21
  function readUsers() {
package/index.html CHANGED
@@ -538,8 +538,8 @@ async function doLogin() {
538
538
  try {
539
539
  const res = await fetch(API_BASE + '/api/login', {
540
540
  method: 'POST',
541
- headers: { 'Content-Type': 'application/json' },
542
- body: JSON.stringify({ username, password }),
541
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
542
+ body: new URLSearchParams({ username, password }),
543
543
  });
544
544
  const data = await res.json();
545
545
 
@@ -567,8 +567,8 @@ async function doLogin() {
567
567
  } else {
568
568
  window.location.href = './browse.html';
569
569
  }
570
- } catch {
571
- errEl.textContent = 'Network error. Try again.';
570
+ } catch (err) {
571
+ errEl.textContent = 'Error: ' + (err && err.message ? err.message : err);
572
572
  btn.disabled = false;
573
573
  btn.textContent = 'Sign In';
574
574
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm-math",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "STEM educational toolkit",
5
5
  "main": "index.html",
6
6
  "files": [