fix: make readFile in api/patrons async

This commit is contained in:
sup39 2024-03-01 07:51:26 +09:00 committed by naskya
parent 1d6b1d052d
commit 85c034b1a2
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -1,5 +1,5 @@
import define from "@/server/api/define.js";
import * as fs from "node:fs";
import * as fs from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
@ -24,10 +24,10 @@ export const paramDef = {
export default define(meta, paramDef, async (ps) => {
const patrons = JSON.parse(
fs.readFileSync(`${_dirname}/../../../../../../patrons.json`, "utf-8"),
await fs.readFile(`${_dirname}/../../../../../../patrons.json`, "utf-8"),
);
return {
patrons: patrons["patrons"],
sponsors: patrons["sponsors"],
patrons: patrons.patrons,
sponsors: patrons.sponsors,
};
});