From d44c080a85a967d23d66885d38fa61a464c46976 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 21 Oct 2025 11:44:10 +0800 Subject: [PATCH] New fetch function --- src/utils/functions/fetchApi.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/utils/functions/fetchApi.ts diff --git a/src/utils/functions/fetchApi.ts b/src/utils/functions/fetchApi.ts new file mode 100644 index 0000000..0211fa1 --- /dev/null +++ b/src/utils/functions/fetchApi.ts @@ -0,0 +1,13 @@ +import { ofetch } from 'ofetch' + +const API = import.meta.env.VITE_BACKEND + +export default async (api: string) => { + try { + const fetch = await ofetch(API + api) + const result = fetch.result + return result + } catch { + return false + } +}