-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): add option to enable disable chapters
- Loading branch information
1 parent
bd5fcef
commit 1ec1260
Showing
7 changed files
with
112 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,55 @@ | ||
using Mangarr.Shared.Models; | ||
using FluentResults; | ||
using Mangarr.Frontend.Api; | ||
using Mangarr.Shared.Models; | ||
using Mangarr.Shared.Responses; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Mangarr.Frontend.Pages.Manga.Item; | ||
|
||
public partial class ContentList | ||
{ | ||
[Inject] public BackendApi BackendApi { get; set; } = null!; | ||
|
||
[Parameter] public string? Id { get; set; } | ||
[Parameter] public List<MangaChapterModel> Items { get; set; } = new(); | ||
|
||
private async Task EnableChapters() | ||
{ | ||
Result<MangaEnableChaptersResponse> result = await BackendApi.EnableMangaChapters(Id); | ||
|
||
if (result.IsFailed) | ||
{ | ||
// TODO: Log error | ||
} | ||
|
||
await UpdateChapters(); | ||
} | ||
|
||
private async Task DisableChapters() | ||
{ | ||
Result<MangaDisableChaptersResponse> result = await BackendApi.DisableMangaChapters(Id); | ||
|
||
if (result.IsFailed) | ||
{ | ||
// TODO: Log error | ||
} | ||
|
||
await UpdateChapters(); | ||
} | ||
|
||
private async Task UpdateChapters() | ||
{ | ||
Result<MangaChaptersResponse> result = await BackendApi.GetMangaChapters(Id); | ||
|
||
if (result.IsFailed) | ||
{ | ||
// TODO: Log error | ||
} | ||
else | ||
{ | ||
Items = result.Value.Data; | ||
} | ||
|
||
await InvokeAsync(StateHasChanged); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.chapter-monitor { | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters