mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add dashboard
This commit is contained in:
19
dashboard/composables/useCustomRequest.ts
Normal file
19
dashboard/composables/useCustomRequest.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
export function createRequestOptions(method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', sign: boolean, body?: Record<string, any>, headers: Record<string, string> = {}) {
|
||||
|
||||
|
||||
const requestHeaders = sign ? signHeaders(headers) : headers;
|
||||
let requestBody;
|
||||
|
||||
if (method === 'POST' || method == 'PUT' || method == 'PATCH') {
|
||||
requestBody = body ? JSON.stringify(body) : undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
method,
|
||||
headers: requestHeaders,
|
||||
body: requestBody
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user