Shortcodes

This commit is contained in:
cdricms
2025-02-10 08:52:32 +01:00
parent a7ad045631
commit 8e87d834bc
20 changed files with 485 additions and 71 deletions

View File

@@ -0,0 +1,13 @@
import IShortcode from "@/interfaces/IShortcode";
import request from "./request";
export default async function getShortcode(code: string): Promise<IShortcode> {
const res = await request<IShortcode>(`/shortcodes/${code}`, {
method: "GET",
requiresAuth: false,
});
if (res.status === "Error" || !res.data)
throw new Error("Shortcode doesn't exist.");
return res.data;
}

View File

@@ -12,7 +12,6 @@ export default async function request<T>(
cookies?: () => Promise<ReadonlyRequestCookies>;
} = {},
): Promise<ApiResponse<T>> {
console.log("Hello everyone");
const { method = "GET", body, requiresAuth = true } = options;
const headers: Record<string, string> = {
"Content-Type": "application/json",