From 321109e06415cd155d2999ce0612452201a8b0a9 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 4 Nov 2025 16:53:35 +0800 Subject: [PATCH] Added post api function --- src/utils/functions/postApi.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/utils/functions/postApi.ts diff --git a/src/utils/functions/postApi.ts b/src/utils/functions/postApi.ts new file mode 100644 index 0000000..7bda182 --- /dev/null +++ b/src/utils/functions/postApi.ts @@ -0,0 +1,22 @@ +import { ofetch } from 'ofetch' +import { SHA3 } from 'crypto-js' + +const API = import.meta.env.VITE_BACKEND + +export default async (api: string, body: Object) => { + + try { + await ofetch(API + api, { + headers: { + Accept: 'application/json', + 'Cache-Control': 'no-cache', + 'OCBO-Token': '', + }, + method: 'POST', + body: body, + }) + return true + } catch { + return false + } +}