Funkční generování QR kódů

This commit is contained in:
2023-06-17 09:32:41 +02:00
parent 45c2f9e264
commit 55b9d1681e
9 changed files with 174 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ import os from 'os';
import path from 'path';
import fs from 'fs';
import axios from 'axios';
import { formatDate } from './utils';
type PizzaSize = {
varId: number,
@@ -85,10 +86,7 @@ const downloadPizzy = async () => {
export const fetchPizzy = async (): Promise<Pizza[]> => {
const tmpDir = os.tmpdir();
const date_ob = new Date();
const date = ("0" + date_ob.getDate()).slice(-2);
const month = ("0" + (date_ob.getMonth() + 1)).slice(-2);
const year = date_ob.getFullYear();
const dateStr = year + "-" + month + "-" + date;
const dateStr = formatDate(date_ob);
const dataPath = path.join(tmpDir, `chefie-${dateStr}.json`);
if (fs.existsSync(dataPath)) {