Added post api function
This commit is contained in:
parent
9ffae4ed03
commit
321109e064
1 changed files with 22 additions and 0 deletions
22
src/utils/functions/postApi.ts
Normal file
22
src/utils/functions/postApi.ts
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue