refactor: standardize authorization header handling in queueTask
This commit is contained in:
@@ -132,6 +132,7 @@ function buildTask(
|
|||||||
scheduleTime = Duration.fromDurationLike(delay).as("second");
|
scheduleTime = Duration.fromDurationLike(delay).as("second");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const authorizationHeader = headers?.["X-Anilist-Token"] ? { Authorization: `Bearer ${headers["X-Anilist-Token"]}` } : {};
|
||||||
|
|
||||||
switch (queueName) {
|
switch (queueName) {
|
||||||
case "ANILIST_UPDATES":
|
case "ANILIST_UPDATES":
|
||||||
@@ -140,8 +141,8 @@ function buildTask(
|
|||||||
body,
|
body,
|
||||||
scheduleTime,
|
scheduleTime,
|
||||||
headers: {
|
headers: {
|
||||||
|
...authorizationHeader,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Anilist-Token": headers?.["X-Anilist-Token"],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user