switch
This commit is contained in:
Vendored
+10
-4
@@ -205,10 +205,16 @@ export class SafelinkClient {
|
|||||||
} else {
|
} else {
|
||||||
await this.db.transaction(async db => {
|
await this.db.transaction(async db => {
|
||||||
for (const rule of res.data.events) {
|
for (const rule of res.data.events) {
|
||||||
if (rule.eventType === 'removeRule') {
|
switch (rule.eventType) {
|
||||||
await this.removeRule(db, rule)
|
case 'removeRule':
|
||||||
} else {
|
await this.removeRule(db, rule)
|
||||||
await this.addRule(db, rule)
|
break
|
||||||
|
case 'addRule':
|
||||||
|
case 'updateRule':
|
||||||
|
await this.addRule(db, rule)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
redirectLogger.warn({rule}, 'received unknown rule event type')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user