mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-12 15:30:53 +02:00
fix non-https crypto issue
This commit is contained in:
@@ -82,10 +82,17 @@ function nextAvailableCombo(rows: BudgetRow[]): {
|
|||||||
return { unit: "usd", period: "monthly" };
|
return { unit: "usd", period: "monthly" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function newRowKey(): string {
|
||||||
|
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
return `tmp-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function newBudgetRow(rows: BudgetRow[]): BudgetRow {
|
export function newBudgetRow(rows: BudgetRow[]): BudgetRow {
|
||||||
const combo = nextAvailableCombo(rows);
|
const combo = nextAvailableCombo(rows);
|
||||||
return {
|
return {
|
||||||
key: crypto.randomUUID(),
|
key: newRowKey(),
|
||||||
amount: "",
|
amount: "",
|
||||||
unit: combo.unit,
|
unit: combo.unit,
|
||||||
period: combo.period
|
period: combo.period
|
||||||
|
|||||||
Reference in New Issue
Block a user