Add to the FAV button @Html.AntiForgeryToken
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
@model Francesco.Recipes.World.Models.BackendModels.Recipe.Recipe
|
||||
|
||||
<button class="btn btn-link p-0"
|
||||
style="width: 40px; height: 40px;"
|
||||
hx-post="@Url.Action(Model.IsFavorite ? "RemoveFavorite" : "AddFavorite", "Recipe")"
|
||||
hx-vals='{"recipeId": "@Model.Id"}'
|
||||
<form hx-post="@Url.Action(Model.IsFavorite ? "RemoveFavorite" : "AddFavorite", "Recipe")"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML">
|
||||
@Html.AntiForgeryToken()
|
||||
<input type="hidden" name="recipeId" value="@Model.Id" />
|
||||
<button type="submit" class="btn btn-link p-0" style="width: 40px; height: 40px;">
|
||||
@if (Model.IsFavorite)
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#FFD700">
|
||||
@@ -22,4 +22,5 @@
|
||||
2 9.24l5.46 4.73L5.82 21z" />
|
||||
</svg>
|
||||
}
|
||||
</button>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user