move formatCurrency to commonjs

This commit is contained in:
vinchent 2024-08-22 10:01:54 +02:00
parent 1bedaaeecf
commit 479183ea13
4 changed files with 13 additions and 25 deletions

View File

@ -1,3 +1,5 @@
import {formatCurrency} from "./common.js"
export function showTable(api) { export function showTable(api) {
let token = localStorage.getItem("token"); let token = localStorage.getItem("token");
let tbody = document.getElementById("sales-table").getElementsByTagName("tbody")[0]; let tbody = document.getElementById("sales-table").getElementsByTagName("tbody")[0];
@ -43,11 +45,3 @@ export function showTable(api) {
} }
}); });
} }
function formatCurrency(amount) {
let c = parseFloat(amount/100);
return c.toLocaleString("fr-FR", {
style:"currency",
currency: "EUR",
});
}

View File

@ -1,3 +1,5 @@
import {formatCurrency} from "./common.js"
export function showTable(api) { export function showTable(api) {
let token = localStorage.getItem("token"); let token = localStorage.getItem("token");
let tbody = document.getElementById("subscriptions-table").getElementsByTagName("tbody")[0]; let tbody = document.getElementById("subscriptions-table").getElementsByTagName("tbody")[0];
@ -44,11 +46,3 @@ export function showTable(api) {
}); });
} }
function formatCurrency(amount) {
let c = parseFloat(amount/100);
return c.toLocaleString("fr-FR", {
style:"currency",
currency: "EUR",
});
}

View File

@ -91,3 +91,10 @@ export function checkAuth(api) {
} }
} }
export function formatCurrency(amount) {
let c = parseFloat(amount/100);
return c.toLocaleString("fr-FR", {
style:"currency",
currency: "EUR",
});
}

View File

@ -1,3 +1,5 @@
import {formatCurrency} from "./common.js"
export function showInfo(api) { export function showInfo(api) {
let token = localStorage.getItem("token"); let token = localStorage.getItem("token");
let id = window.location.pathname.split("/").pop(); let id = window.location.pathname.split("/").pop();
@ -24,12 +26,3 @@ export function showInfo(api) {
} }
}); });
} }
function formatCurrency(amount) {
let c = parseFloat(amount/100);
return c.toLocaleString("fr-FR", {
style:"currency",
currency: "EUR",
});
}