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:
		
							parent
							
								
									d270f2a045
								
							
						
					
					
						commit
						643c8b3c77
					
				
							
								
								
									
										4
									
								
								server/middleware/20.cidx.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								server/middleware/20.cidx.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | export default eventHandler((ev) => { | ||||||
|  | 	let chapParam = getRouterParams(ev).chapter; | ||||||
|  | 	ev.context.chapterIndex = !!chapParam ? parseInt(chapParam) - 1 : 0; | ||||||
|  | }); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user