|
|
|
@ -23,12 +23,12 @@ public partial class EditChapter
|
|
|
|
|
[Inject]
|
|
|
|
|
public ILogger<EditChapter> Logger { get; set; }
|
|
|
|
|
|
|
|
|
|
private string oldChapterName { get; set; }
|
|
|
|
|
private string OldChapterName { get; set; }
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
var chapter = await DataService.GetById(Id);
|
|
|
|
|
oldChapterName = chapter.Name;
|
|
|
|
|
OldChapterName = chapter.Name;
|
|
|
|
|
|
|
|
|
|
// Set the model with the chapter
|
|
|
|
|
chapterModel = new ChapterModel
|
|
|
|
@ -55,8 +55,6 @@ public partial class EditChapter
|
|
|
|
|
var response = await httpClient.PostAsync(apiUri, formContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.LogInformation("Chapter '{OldChapterModelName}' edited in '{NewChapterModelName}'",oldChapterName,chapterModel.Name);
|
|
|
|
|
|
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
|
|
|
{
|
|
|
|
|
var responseBody = await response.Content.ReadAsStringAsync();
|
|
|
|
@ -66,6 +64,8 @@ public partial class EditChapter
|
|
|
|
|
var errorResponse = await response.Content.ReadAsStringAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Logger.LogInformation("Chapter '{OldChapterModelName}' edited in '{NewChapterModelName}'", OldChapterName, chapterModel.Name);
|
|
|
|
|
NavigationManager.NavigateTo("chapters");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|