Fix bug
This commit is contained in:
		
							parent
							
								
									93140daf79
								
							
						
					
					
						commit
						6b7ed74467
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -3,9 +3,13 @@ import * as mongo from 'mongodb';
 | 
				
			||||||
import Subscription from '../models/sw-subscription';
 | 
					import Subscription from '../models/sw-subscription';
 | 
				
			||||||
import config from '../../conf';
 | 
					import config from '../../conf';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (config.sw) {
 | 
				
			||||||
	push.setGCMAPIKey(config.sw.gcm_api_key);
 | 
						push.setGCMAPIKey(config.sw.gcm_api_key);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default async function(userId: mongo.ObjectID | string, type, body?) {
 | 
					export default async function(userId: mongo.ObjectID | string, type, body?) {
 | 
				
			||||||
 | 
						if (!config.sw) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (typeof userId === 'string') {
 | 
						if (typeof userId === 'string') {
 | 
				
			||||||
		userId = new mongo.ObjectID(userId);
 | 
							userId = new mongo.ObjectID(userId);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue