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

Commit 2bb6b4d

Browse files
committed
- removed unused else, variable (in catch block), directives.
1 parent 3ca351c commit 2bb6b4d

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

TodoListWebApp/Controllers/HomeController.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Diagnostics;
4-
using System.Linq;
5-
using System.Threading.Tasks;
1+
using System.Diagnostics;
62
using Microsoft.AspNetCore.Authorization;
73
using Microsoft.AspNetCore.Mvc;
84
using WebApp_OpenIDConnect_DotNet.Models;

TodoListWebApp/Controllers/TodoController.cs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,25 @@ public async Task<IActionResult> Index()
5858

5959
return View(itemList);
6060
}
61-
else
61+
62+
//
63+
// If the call failed with access denied, then drop the current access token from the cache,
64+
// and show the user an error indicating they might need to sign-in again.
65+
//
66+
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
6267
{
63-
//
64-
// If the call failed with access denied, then drop the current access token from the cache,
65-
// and show the user an error indicating they might need to sign-in again.
66-
//
67-
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
68-
{
69-
var todoTokens = authContext.TokenCache.ReadItems().Where(a => a.Resource == AzureAdOptions.Settings.TodoListResourceId);
70-
foreach (TokenCacheItem tci in todoTokens)
71-
authContext.TokenCache.DeleteItem(tci);
68+
var todoTokens = authContext.TokenCache.ReadItems().Where(a => a.Resource == AzureAdOptions.Settings.TodoListResourceId);
69+
foreach (TokenCacheItem tci in todoTokens)
70+
authContext.TokenCache.DeleteItem(tci);
7271

73-
ViewBag.ErrorMessage = "UnexpectedError";
74-
TodoItem newItem = new TodoItem();
75-
newItem.Title = "(No items in list)";
76-
itemList.Add(newItem);
77-
return View(itemList);
78-
}
72+
ViewBag.ErrorMessage = "UnexpectedError";
73+
TodoItem newItem = new TodoItem();
74+
newItem.Title = "(No items in list)";
75+
itemList.Add(newItem);
76+
return View(itemList);
7977
}
8078
}
81-
catch (Exception ee)
79+
catch (Exception)
8280
{
8381
if (HttpContext.Request.Query["reauth"] == "True")
8482
{

0 commit comments

Comments
 (0)