diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-21 07:19:02 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-21 07:19:02 +0900 |
| commit | 6b7ed744677d48be40c76ffe0cde0524c1698dd0 (patch) | |
| tree | aee38ce45c74b58905128dd1674e98c7cf6f266f /src/api/common | |
| parent | Fix bug (diff) | |
| download | sharkey-6b7ed744677d48be40c76ffe0cde0524c1698dd0.tar.gz sharkey-6b7ed744677d48be40c76ffe0cde0524c1698dd0.tar.bz2 sharkey-6b7ed744677d48be40c76ffe0cde0524c1698dd0.zip | |
Fix bug
Diffstat (limited to 'src/api/common')
| -rw-r--r-- | src/api/common/push-sw.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/common/push-sw.ts b/src/api/common/push-sw.ts index 927dc50635..782a4a6a6c 100644 --- a/src/api/common/push-sw.ts +++ b/src/api/common/push-sw.ts @@ -3,9 +3,13 @@ import * as mongo from 'mongodb'; import Subscription from '../models/sw-subscription'; import config from '../../conf'; -push.setGCMAPIKey(config.sw.gcm_api_key); +if (config.sw) { + push.setGCMAPIKey(config.sw.gcm_api_key); +} export default async function(userId: mongo.ObjectID | string, type, body?) { + if (!config.sw) return; + if (typeof userId === 'string') { userId = new mongo.ObjectID(userId); } |