Skip to content

Commit 0360ab1

Browse files
committed
Removes extra heart logic, adjusts warning string, adjusts .net cli link
1 parent 84c84b1 commit 0360ab1

File tree

1 file changed

+3
-33
lines changed

1 file changed

+3
-33
lines changed

articles/azure-app-configuration/use-variant-feature-flags-aspnet-core.md

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
1717

1818
## Prerequisites
1919

20-
* Ensure the [.NET CLI](dotnet/core/tools) is installed on your machine.
20+
* Ensure the [.NET CLI](/dotnet/core/tools) is installed on your machine.
2121
* Follow the [Use variant feature flags](./use-variant-feature-flags.md) tutorial and create the variant feature flag named *Greeting*.
2222

2323
## Create an ASP.NET Core web app
@@ -128,27 +128,13 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
128128
}
129129
else
130130
{
131-
_logger.LogWarning("Greeting variant not found. Please define a variant feature flag in Azure App Configuration named 'Greeting'.");
132-
}
133-
}
134-
135-
public IActionResult OnPostHeartQuoteAsync()
136-
{
137-
string? userId = User.Identity?.Name;
138-
139-
if (!string.IsNullOrEmpty(userId))
140-
{
141-
return new JsonResult(new { success = true });
142-
}
143-
else
144-
{
145-
return new JsonResult(new { success = false, error = "User not authenticated" });
131+
_logger.LogWarning("No variant given. Either the feature flag named 'Greeting' is not defined or the variants are not defined properly.");
146132
}
147133
}
148134
}
149135
```
150136
151-
You call `GetVariantAsync` to retrieve the variant of the *Greeting* feature flag for the current user and assign its value to the `GreetingMessage` property of the page model. This page model also includes a handler for POST requests, which are triggered when users like the quote and click the heart button.
137+
You call `GetVariantAsync` to retrieve the variant of the *Greeting* feature flag for the current user and assign its value to the `GreetingMessage` property of the page model.
152138
153139
1. In *QuoteOfTheDay* > *Pages* > *Shared* > *_Layout.cshtml*, under where `QuoteOfTheDay.styles.css` is added, add the following reference to the font-awesome CSS library.
154140
@@ -234,29 +220,13 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
234220
<i class="far fa-heart"></i> <!-- Heart icon -->
235221
</button>
236222
</div>
237-
238-
<form action="/" method="post">
239-
@Html.AntiForgeryToken()
240-
</form>
241223
</div>
242224
243225
<script>
244226
function heartClicked(button) {
245227
var icon = button.querySelector('i');
246228
icon.classList.toggle('far');
247229
icon.classList.toggle('fas');
248-
249-
// If the quote is hearted
250-
if (icon.classList.contains('fas')) {
251-
// Send a request to the server to save the vote
252-
fetch('/Index?handler=HeartQuote', {
253-
method: 'POST',
254-
headers: {
255-
'Content-Type': 'application/json',
256-
'RequestVerificationToken': document.querySelector('input[name="__RequestVerificationToken"]').value
257-
}
258-
});
259-
}
260230
}
261231
</script>
262232
```

0 commit comments

Comments
 (0)