mirror of
https://github.com/sr229/kuru-kuru.git
synced 2024-09-20 04:10:33 +00:00
feat: Update globalCount type to bigint
Update globalCount type from number to bigint in CounterCard and index files, and in setGlobalStatistics function
This commit is contained in:
parent
f2abd5110c
commit
238c01bcd7
3 changed files with 5 additions and 5 deletions
|
@ -3,7 +3,7 @@ import { useEffect, useState } from "preact/hooks";
|
||||||
import axios from "axios-web";
|
import axios from "axios-web";
|
||||||
|
|
||||||
interface SharedProps {
|
interface SharedProps {
|
||||||
globalCount: number;
|
globalCount: bigint;
|
||||||
audioFiles: string[];
|
audioFiles: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ export const handler: Handlers = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Home(
|
export default function Home(
|
||||||
{ data: { globalCount } }: { data: { globalCount: number } },
|
{ data: { globalCount } }: { data: { globalCount: bigint } },
|
||||||
) {
|
) {
|
||||||
// added a pseudo-div here so I can nest another div inside it smh
|
// added a pseudo-div here so I can nest another div inside it smh
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const kv = await Deno.openKv();
|
const kv = await Deno.openKv();
|
||||||
|
|
||||||
export async function getGlobalStatistics() {
|
export async function getGlobalStatistics() {
|
||||||
const res = await kv.get<number>(["global-statistics"]) ?? 0;
|
const res = await kv.get<bigint>(["global-statistics"])!;
|
||||||
return res.value ?? 0;
|
return res.value!;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setGlobalStatistics(value: number) {
|
export async function setGlobalStatistics(value: bigint) {
|
||||||
const pv = await getGlobalStatistics();
|
const pv = await getGlobalStatistics();
|
||||||
await kv.set(["global-statistics"], pv + value);
|
await kv.set(["global-statistics"], pv + value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue