Skip to content

Commit

Permalink
Update TVDBSwift
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Caselani committed Dec 16, 2019
1 parent 944fe7b commit 540566a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions TVDBSwift/Endpoints/Authentication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ extension Authentication: TVDBType {
}
}

public var authorizationType: AuthorizationType {
public var authorizationType: AuthorizationType? {
switch self {
case .login: return .none
case .login: return nil
case .refreshToken: return .bearer
}
}
Expand Down
7 changes: 3 additions & 4 deletions TVDBSwift/TVDB.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Moya
import Result
import RxSwift

public class TVDB {
Expand Down Expand Up @@ -64,9 +63,9 @@ public class TVDB {

interceptors.append(TVDBTokenRequestInterceptor(tvdb: self))

plugins.append(AccessTokenPlugin { [weak self] () -> String in
self?.token ?? ""
})
plugins.append(AccessTokenPlugin(tokenClosure: { [token] _ -> String in
token ?? ""
}))
}

func createProvider<T: TVDBType>(forTarget target: T.Type) -> MoyaProvider<T> {
Expand Down
1 change: 0 additions & 1 deletion TVDBSwift/TVDBTokenRequestInterceptor.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Moya
import Result

final class TVDBTokenRequestInterceptor: RequestInterceptor {
private weak var tvdb: TVDB?
Expand Down
2 changes: 1 addition & 1 deletion TVDBSwift/TVDBType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public extension TVDBType {

var method: Moya.Method { return .get }

var authorizationType: AuthorizationType { return .bearer }
var authorizationType: AuthorizationType? { return .bearer}

var sampleData: Data { return Data() }
}
Expand Down

0 comments on commit 540566a

Please sign in to comment.