-
+
diff --git a/src/pages/api/badge/[username].ts b/src/pages/api/badge/[username].ts
index 152956c7..3e77f986 100644
--- a/src/pages/api/badge/[username].ts
+++ b/src/pages/api/badge/[username].ts
@@ -1,7 +1,7 @@
import { badgen } from "badgen";
import type { StyleOption } from "badgen";
-import { FormatNumber } from "../../../utils/FormatNumber";
-import { IncreaseViews, GetViews } from "@/database/index";
+import { FormatNumber } from "../../../utils/FormatNumber.ts";
+import { IncreaseViews, GetViews } from "../../../database/index.ts";
interface QueryParams {
label?: string;
@@ -17,7 +17,7 @@ export const GET = async function GET({ params, request }: { params: { username:
const query = new URL(request.url).searchParams;
const { label, labelColor, color, style, format, display }: QueryParams = Object.fromEntries(query);
const { username } = params;
- const number: number = display ? await GetViews(username) : await IncreaseViews(username);
+ const views: number = display ? await GetViews(username) : await IncreaseViews(username);
// Validate the format to ensure it's "short" or "long"
const isValidFormat = format === "short" || format === "long";
@@ -25,7 +25,7 @@ export const GET = async function GET({ params, request }: { params: { username:
const badge = badgen({
label: label || "Views",
labelColor: labelColor,
- status: FormatNumber(number, isValidFormat ? format! : "short"),
+ status: FormatNumber(views, isValidFormat ? format! : "short"),
color: color,
style: style || "flat",
});
diff --git a/src/pages/api/json/[username].ts b/src/pages/api/json/[username].ts
index 5ca2ac68..3cc02c0e 100644
--- a/src/pages/api/json/[username].ts
+++ b/src/pages/api/json/[username].ts
@@ -1,7 +1,6 @@
-import type { APIRoute } from "astro";
-import { GetViews } from "@/database/index";
+import { GetViews } from "../../../database/index.ts";
-export const GET: APIRoute = async function GET({ params }: { params: { username: string } }): Promise
{
+export const GET = async function GET({ params }: { params: { username: string } }): Promise {
try {
const { username } = params;
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 52a87f0a..a28b3838 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -4,7 +4,7 @@ import Header from "../components/Header.astro";
import Image from "../components/Image.astro";
import Input from "../components/Input.astro";
import Layout from "../layouts/Layout.astro";
-let url = "/api/badge/example";
+const url = "/api/badge/example";
---
@@ -22,71 +22,73 @@ let url = "/api/badge/example";
Looking for more customizations?
@@ -118,7 +120,7 @@ let url = "/api/badge/example";
});
-