Skip to content

Commit

Permalink
Check status code
Browse files Browse the repository at this point in the history
  • Loading branch information
ngs committed Jun 30, 2018
1 parent 6d20c0b commit 80b2677
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CI2Go/View Controllers/BuildsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ class BuildsViewController: UITableViewController {
}

func loadUser() {
URLSession.shared.dataTask(endpoint: .me) { [weak self] (user, _, _, err) in
URLSession.shared.dataTask(endpoint: .me) { [weak self] (user, _, res, err) in
guard let user = user else {
Crashlytics.sharedInstance().recordError(err ?? APIError.noData)
self?.logout()
if let res = res as? HTTPURLResponse, res.statusCode == 401 {
self?.logout()
}
return
}
self?.currentUser = user
Expand Down

0 comments on commit 80b2677

Please sign in to comment.