replace node-fetch with axios in src

This commit is contained in:
Michael C
2021-09-23 01:21:10 -04:00
parent a23387c877
commit 6433f50edf
10 changed files with 150 additions and 107 deletions

View File

@@ -1,6 +1,6 @@
import {config} from "../config";
import {Logger} from "../utils/logger";
import fetch from "node-fetch";
import axios from "axios";
function getVoteAuthorRaw(submissionCount: number, isVIP: boolean, isOwnSubmission: boolean): string {
if (isOwnSubmission) {
@@ -37,9 +37,10 @@ function dispatchEvent(scope: string, data: Record<string, unknown>): void {
const scopes = webhook.scopes || [];
if (!scopes.includes(scope.toLowerCase())) return;
fetch(webhookURL, {
axios.request({
url: webhookURL,
method: "POST",
body: JSON.stringify(data),
data,
headers: {
"Authorization": authKey,
"Event-Type": scope, // Maybe change this in the future?