Even better
This commit is contained in:
		
							parent
							
								
									df59c6b65c
								
							
						
					
					
						commit
						2c05140382
					
				
					 2 changed files with 10 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -154,10 +154,3 @@ router.get("/:account/", defineEventHandler({
 | 
			
		|||
		return pugSync.render(event, `${arrange}_${shape}.pug`, locals)
 | 
			
		||||
	}
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
pugSync.beforeInclude("tag_grid.pug", async (from, event, {account}) => {
 | 
			
		||||
	return {
 | 
			
		||||
		downloadManager: loadTags.downloadManager,
 | 
			
		||||
		downloader: loadTags.downloadManager.check(account)
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -124,14 +124,20 @@ const schema = z.object({
 | 
			
		|||
 | 
			
		||||
router.get("/api/tag-download", defineEventHandler(async event => {
 | 
			
		||||
	const {account} = await getValidatedQuery(event, schema.parse)
 | 
			
		||||
	const downloader = downloadManager.check(account)
 | 
			
		||||
	return pugSync.render(event, "includes/tag-status.pug", {downloader, account})
 | 
			
		||||
	return pugSync.render(event, "includes/tag-status.pug", {account})
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
router.post("/api/tag-download", defineEventHandler(async event => {
 | 
			
		||||
	const {account} = await readValidatedBody(event, schema.parse)
 | 
			
		||||
	const downloader = downloadManager.start(account)
 | 
			
		||||
	return pugSync.render(event, "includes/tag-status.pug", {downloader, account})
 | 
			
		||||
	downloadManager.start(account)
 | 
			
		||||
	return pugSync.render(event, "includes/tag-status.pug", {account})
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
pugSync.beforeInclude("includes/tag-status.pug", async (from, event, {account}) => {
 | 
			
		||||
	return {
 | 
			
		||||
		downloadManager,
 | 
			
		||||
		downloader: downloadManager.check(account)
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
module.exports.downloadManager = downloadManager
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue