Skip to content

Commit

Permalink
⚡ Do not attempt to update hooks when feature is not supported by server
Browse files Browse the repository at this point in the history
  • Loading branch information
stoeffn committed Oct 24, 2018
1 parent 5b21d5c commit b622ea7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions StudKit/Notifications/HookService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public final class HookService {
// MARK: - Updating Hooks

func updateOrCreate(hook: Hook, completion: @escaping ResultHandler<Hook>) {
guard User.current?.organization.supportsNotifications ?? false else { return }
studIpService.api.requestDecoded(.updateOrCreateHook(hook)) { (result: Result<Hook>) in completion(result) }
}

Expand All @@ -86,6 +87,7 @@ public final class HookService {
}

func deleteHook(withId hookId: String, completion: @escaping ResultHandler<Void>) {
guard User.current?.organization.supportsNotifications ?? false else { return }
studIpService.api.request(.deleteHook(withId: hookId)) { completion($0.map { _ in }) }
}

Expand Down

0 comments on commit b622ea7

Please sign in to comment.