From bbeb14bac03701926fafa2e3a8bcce846b96e26e Mon Sep 17 00:00:00 2001 From: cohenaj194 Date: Thu, 13 Jun 2024 18:57:16 -0400 Subject: [PATCH] add new request page --- app/requests/GetBlog.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/requests/GetBlog.ts diff --git a/app/requests/GetBlog.ts b/app/requests/GetBlog.ts new file mode 100644 index 00000000..b0ded614 --- /dev/null +++ b/app/requests/GetBlog.ts @@ -0,0 +1,31 @@ +import { address, UserAgent } from '~/requests/client/config' + +export interface BlogResponse { + itemID: number + itemDescription: string +} + +export interface GetBlogProps { + itemId: number +} + +const GetBlog: ({ itemId }: GetBlogProps) => Promise = async ({ + itemId +}) => { + const requestBody = JSON.stringify({ + item_id: itemId + }) + + console.log('Request body:', requestBody) + + return fetch(`${address}/api/ffxiv/blog`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'User-Agent': UserAgent + }, + body: requestBody + }) +} + +export default GetBlog