refactor(api): ♻️ Use URL literal instead of strings

This commit is contained in:
Jesse Wierzbinski 2025-02-01 16:32:18 +01:00
parent 99fac323c8
commit 76d1ccc859
No known key found for this signature in database
50 changed files with 343 additions and 256 deletions

View file

@ -72,7 +72,11 @@ export default apiRoute((app) =>
const userJson = user.toVersia();
const { headers } = await user.sign(userJson, context.req.url, "GET");
const { headers } = await user.sign(
userJson,
new URL(context.req.url),
"GET",
);
return context.json(userJson, 200, headers.toJSON());
}),

View file

@ -107,7 +107,7 @@ export default apiRoute((app) =>
config.http.base_url,
).toString(),
total: totalNotes,
author: author.getUri(),
author: author.getUri().toString(),
next:
notes.length === NOTES_PER_PAGE
? new URL(
@ -125,7 +125,11 @@ export default apiRoute((app) =>
items: notes.map((note) => note.toVersia()),
};
const { headers } = await author.sign(json, context.req.url, "GET");
const { headers } = await author.sign(
json,
new URL(context.req.url),
"GET",
);
return context.json(json, 200, headers.toJSON());
}),