// Saves a size mode on the logged-in user's account (needs the redmine_tonalmine plugin). // No size resets the account to the default appearance. export async function setSize(page, size) { const status = await page.evaluate(async (body) => { const headers = { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest', 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content }; return (await fetch('/tonalmine/appearance', { method: 'PUT', headers, body: JSON.stringify(body) })).status; }, size ? { size } : {}); if (status !== 204) throw new Error(`could not save size ${size ?? 'default'} (HTTP ${status})`); }