Add sorting columns

This commit is contained in:
Neil Brommer 2022-04-19 13:04:38 -07:00
parent adf24cbd5c
commit 90adbcfb7c
34 changed files with 833 additions and 80 deletions

View file

@ -5,6 +5,8 @@ using Refit;
using Start.Shared;
using Start.Shared.Api;
using Start.Client.Store.Features.ContainersList;
using System.Collections.Generic;
using System.Linq;
namespace Start.Client.Store.Features.CreateContainer {
public class CreateContainerEffects {
@ -20,8 +22,22 @@ namespace Start.Client.Store.Features.CreateContainer {
dispatch.Dispatch(new FetchCreateContainerAction());
try {
ApiResponse<IEnumerable<BookmarkContainerDto>>? containersResponse = await this
.BookmarkContainersApi
.GetAllBookmarkContainers();
if (containersResponse == null || containersResponse.Content == null) {
dispatch.Dispatch(new ErrorFetchingCreateContainerAction(
"There was an error checking bookmark containers"));
return;
}
int sortOrder = !containersResponse.Content.Any()
? 0
: containersResponse.Content.Max(c => c.SortOrder) + 1;
ApiResponse<BookmarkContainerDto?> apiResponse = await this.BookmarkContainersApi
.CreateBookmarkContainer(action.NewContainer.Title);
.CreateBookmarkContainer(action.NewContainer.Title, sortOrder);
BookmarkContainerDto? container = apiResponse.Content;