Skip to content
This repository was archived by the owner on Jan 23, 2020. It is now read-only.

Commit 7b428f1

Browse files
committed
- removed redundent else.
1 parent 9d36002 commit 7b428f1

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

TodoListWebApp/Controllers/TodoController.cs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,22 @@ public async Task<ActionResult> Index(string item)
143143
{
144144
return RedirectToAction("Index");
145145
}
146-
else
146+
147+
//
148+
// If the call failed with access denied, then drop the current access token from the cache,
149+
// and show the user an error indicating they might need to sign-in again.
150+
//
151+
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
147152
{
148-
//
149-
// If the call failed with access denied, then drop the current access token from the cache,
150-
// and show the user an error indicating they might need to sign-in again.
151-
//
152-
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
153-
{
154-
var todoTokens = authContext.TokenCache.ReadItems().Where(a => a.Resource == AzureAdOptions.Settings.TodoListResourceId);
155-
foreach (TokenCacheItem tci in todoTokens)
156-
authContext.TokenCache.DeleteItem(tci);
157-
158-
ViewBag.ErrorMessage = "UnexpectedError";
159-
TodoItem newItem = new TodoItem();
160-
newItem.Title = "(No items in list)";
161-
itemList.Add(newItem);
162-
return View(newItem);
163-
}
153+
var todoTokens = authContext.TokenCache.ReadItems().Where(a => a.Resource == AzureAdOptions.Settings.TodoListResourceId);
154+
foreach (TokenCacheItem tci in todoTokens)
155+
authContext.TokenCache.DeleteItem(tci);
156+
157+
ViewBag.ErrorMessage = "UnexpectedError";
158+
TodoItem newItem = new TodoItem();
159+
newItem.Title = "(No items in list)";
160+
itemList.Add(newItem);
161+
return View(newItem);
164162
}
165163
}
166164
catch (Exception ee)

0 commit comments

Comments
 (0)