Fix bug
This commit is contained in:
		
							parent
							
								
									f0be021d85
								
							
						
					
					
						commit
						8bf05e47df
					
				
					 1 changed files with 30 additions and 24 deletions
				
			
		| 
						 | 
					@ -107,7 +107,7 @@ if (config.twitter == null) {
 | 
				
			||||||
		ctx.redirect(twCtx.url);
 | 
							ctx.redirect(twCtx.url);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	router.get('/tw/cb', ctx => {
 | 
						router.get('/tw/cb', async ctx => {
 | 
				
			||||||
		const userToken = getUserToken(ctx);
 | 
							const userToken = getUserToken(ctx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (userToken == null) {
 | 
							if (userToken == null) {
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,14 @@ if (config.twitter == null) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const get = new Promise<any>((res, rej) => {
 | 
				
			||||||
				redis.get(userToken, async (_, twCtx) => {
 | 
									redis.get(userToken, async (_, twCtx) => {
 | 
				
			||||||
 | 
										res(twCtx);
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const twCtx = await get;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const result = await twAuth.done(JSON.parse(twCtx), verifier);
 | 
								const result = await twAuth.done(JSON.parse(twCtx), verifier);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const user = await User.findOneAndUpdate({
 | 
								const user = await User.findOneAndUpdate({
 | 
				
			||||||
| 
						 | 
					@ -165,7 +172,6 @@ if (config.twitter == null) {
 | 
				
			||||||
				detail: true,
 | 
									detail: true,
 | 
				
			||||||
				includeSecrets: true
 | 
									includeSecrets: true
 | 
				
			||||||
			}));
 | 
								}));
 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue