feat : logs
continuous-integration/drone/push Build is passing Details

pull/38/head
Yvan CALATAYUD 1 year ago
parent f323a92675
commit f7024dac0d

@ -23,9 +23,12 @@ public partial class EditChapter
[Inject] [Inject]
public ILogger<EditChapter> Logger { get; set; } public ILogger<EditChapter> Logger { get; set; }
private string oldChapterName { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var chapter = await DataService.GetById(Id); var chapter = await DataService.GetById(Id);
oldChapterName = chapter.Name;
// Set the model with the chapter // Set the model with the chapter
chapterModel = new ChapterModel chapterModel = new ChapterModel
@ -38,6 +41,7 @@ public partial class EditChapter
private async void HandleValidSubmit() private async void HandleValidSubmit()
{ {
await DataService.Update(Id, chapterModel); await DataService.Update(Id, chapterModel);
var formData = new List<KeyValuePair<string, string>>(); var formData = new List<KeyValuePair<string, string>>();
formData.Add(new KeyValuePair<string, string>("name", chapterModel.Name)); formData.Add(new KeyValuePair<string, string>("name", chapterModel.Name));
@ -51,7 +55,7 @@ public partial class EditChapter
var response = await httpClient.PostAsync(apiUri, formContent); var response = await httpClient.PostAsync(apiUri, formContent);
Logger.LogInformation("Chapter '{chapterModelName}' edited", chapterModel.Name); Logger.LogInformation("Chapter '{OldChapterModelName}' edited in '{NewChapterModelName}'",oldChapterName,chapterModel.Name);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {

Loading…
Cancel
Save