Merge branch 'main' into main

This commit is contained in:
JeelsBoobz 2023-09-13 20:08:20 +07:00 committed by GitHub
commit 094c106b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View File

@ -61,7 +61,7 @@
"tailwindcss": "^3.3.3",
"tailwindcss-safe-area": "^0.4.0",
"typescript": "^5.2.2",
"uuid": "^9.0.0",
"uuid": "^9.0.1",
"vite": "^4.4.9",
"vite-plugin-pwa": "^0.16.5",
"vite-plugin-solid": "^2.7.0",

View File

@ -156,8 +156,8 @@ dependencies:
specifier: ^5.2.2
version: 5.2.2
uuid:
specifier: ^9.0.0
version: 9.0.0
specifier: ^9.0.1
version: 9.0.1
vite:
specifier: ^4.4.9
version: 4.4.9(@types/node@20.6.0)
@ -5894,8 +5894,8 @@ packages:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: false
/uuid@9.0.0:
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
/uuid@9.0.1:
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
hasBin: true
dev: false

View File

@ -26,9 +26,19 @@ export const [endpointList, setEndpointList] = makePersisted(
export const useRequest = () => {
const e = endpoint()
if (!e) {
return ky.create({})
}
const headers = new Headers()
if (e.secret) {
headers.set('Authorization', `Bearer ${e.secret}`)
}
return ky.create({
prefixUrl: e?.url,
headers: { Authorization: e?.secret ? `Bearer ${e.secret}` : '' },
prefixUrl: e.url,
headers,
})
}