mirror of
https://github.com/kbenestad/reimburse.git
synced 2026-06-18 16:04:31 +00:00
Merge pull request #2 from kbenestad/claude/fix-form-layout-P8uHa
Fix crash: state initialized before CFG is loaded
This commit is contained in:
commit
cae6416ffd
1 changed files with 2 additions and 1 deletions
|
|
@ -140,7 +140,7 @@ async function loadConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== STATE ==========
|
// ========== STATE ==========
|
||||||
const state = { staff: '', periodFrom: '', periodTo: '', baseCurrency: CFG['currency-base'], fxRateMemory: {}, items: [], _grandTotal: 0 };
|
const state = { staff: '', periodFrom: '', periodTo: '', baseCurrency: '', fxRateMemory: {}, items: [], _grandTotal: 0 };
|
||||||
|
|
||||||
function newItem() { return { id: uid(), name: '', lines: [newLine()], _subtotal: 0 }; }
|
function newItem() { return { id: uid(), name: '', lines: [newLine()], _subtotal: 0 }; }
|
||||||
function newLine() {
|
function newLine() {
|
||||||
|
|
@ -848,6 +848,7 @@ async function onGenerate() {
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
await loadConfig();
|
await loadConfig();
|
||||||
|
state.baseCurrency = CFG['currency-base'];
|
||||||
state.items.push(newItem());
|
state.items.push(newItem());
|
||||||
render();
|
render();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue