mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(api): ♻️ Use URL literal instead of strings
This commit is contained in:
parent
99fac323c8
commit
76d1ccc859
50 changed files with 343 additions and 256 deletions
|
|
@ -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());
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue