fix(#38,#54): fix apiFetch Content-Type header order; fix normalizeAsset seed hash

This commit is contained in:
Zac Gaetano 2026-05-25 17:42:06 -04:00
parent 75c23448b4
commit 33c82cab1a

View file

@ -18,7 +18,7 @@ async function apiFetch(path, opts = {}) {
const res = await fetch(API + path, { const res = await fetch(API + path, {
credentials: 'include', credentials: 'include',
...opts, ...opts,
headers: { 'Content-Type': 'application/json', ...(opts.headers || {}) }, headers: { ...(opts.headers || {}), 'Content-Type': 'application/json' },
}); });
// 401 from any API call means there's no live session. Bounce to the // 401 from any API call means there's no live session. Bounce to the
// login screen instead of leaving the app in a half-loaded state. // login screen instead of leaving the app in a half-loaded state.
@ -76,7 +76,7 @@ function normalizeAsset(a, projectMap) {
comments: 0, comments: 0,
progress: 0, progress: 0,
tc: a.start_tc || null, tc: a.start_tc || null,
seed: a.id ? a.id.charCodeAt(0) % 6 : 1, seed: a.id ? Array.from(a.id.replace(/-/g, '')).reduce((acc, c) => acc + c.charCodeAt(0), 0) % 6 : 1,
}; };
} }