refactor(server/middleware): create middleware to add the current story's chapter index to the context as an int (if it exists)

because convenience
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2023-10-03 00:56:16 -04:00
parent d270f2a045
commit 643c8b3c77
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -0,0 +1,4 @@
export default eventHandler((ev) => {
let chapParam = getRouterParams(ev).chapter;
ev.context.chapterIndex = !!chapParam ? parseInt(chapParam) - 1 : 0;
});