Create a default container if none exist
This commit is contained in:
		
							parent
							
								
									eee9c01073
								
							
						
					
					
						commit
						45c8899f06
					
				|  | @ -5,6 +5,7 @@ using System.Threading.Tasks; | ||||||
| using Fluxor; | using Fluxor; | ||||||
| using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | using Microsoft.AspNetCore.Components.WebAssembly.Authentication; | ||||||
| using Refit; | using Refit; | ||||||
|  | using Start.Client.Store.Features.CreateContainer; | ||||||
| using Start.Shared; | using Start.Shared; | ||||||
| using Start.Shared.Api; | using Start.Shared.Api; | ||||||
| 
 | 
 | ||||||
|  | @ -33,8 +34,23 @@ namespace Start.Client.Store.Features.ContainersList { | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				if (!bookmarkContainers.Any()) | 				if (!bookmarkContainers.Any()) { | ||||||
| 					throw new NotImplementedException("Create bookmark effect has not been created"); | 					dispatch.Dispatch(new SubmitCreateContainerAction( | ||||||
|  | 						new BookmarkContainerDto("Default", 0))); | ||||||
|  | 
 | ||||||
|  | 					// And load again | ||||||
|  | 					response = await this | ||||||
|  | 						.BookmarkContainersApi | ||||||
|  | 						.GetAllBookmarkContainers(); | ||||||
|  | 
 | ||||||
|  | 					bookmarkContainers = response.Content?.ToList(); | ||||||
|  | 
 | ||||||
|  | 					if (bookmarkContainers == null) { | ||||||
|  | 						dispatch.Dispatch(new ErrorFetchingContainerListAction( | ||||||
|  | 							"Failed to fetch containers list")); | ||||||
|  | 						return; | ||||||
|  | 					} | ||||||
|  | 				} | ||||||
| 
 | 
 | ||||||
| 				dispatch.Dispatch(new RecievedContainerListAction(bookmarkContainers)); | 				dispatch.Dispatch(new RecievedContainerListAction(bookmarkContainers)); | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue