about summary refs log tree commit diff
path: root/BugMine.Web/Pages/Projects/NewProject.razor
diff options
context:
space:
mode:
Diffstat (limited to 'BugMine.Web/Pages/Projects/NewProject.razor')
-rw-r--r--BugMine.Web/Pages/Projects/NewProject.razor36
1 files changed, 29 insertions, 7 deletions
diff --git a/BugMine.Web/Pages/Projects/NewProject.razor b/BugMine.Web/Pages/Projects/NewProject.razor
index 529813e..00b7b21 100644
--- a/BugMine.Web/Pages/Projects/NewProject.razor
+++ b/BugMine.Web/Pages/Projects/NewProject.razor
@@ -1,25 +1,47 @@
 @page "/Projects/New"
-@using LibMatrix.Responses
-@using BugMine.Web.Classes
 @using ArcaneLibs.Extensions
 <h3>New project</h3>
 
 <span>Project name: </span>
-<FancyTextBox bind-Value="@request.Name"></FancyTextBox>
+<FancyTextBox @bind-Value="@_request.Name"></FancyTextBox>
 <br/>
-<span>Shortname: </span>
-<FancyTextBox bind-Value="@request.RoomAliasName"></FancyTextBox>
+<span>Project repository: </span>
+<FancyTextBox @bind-Value="@_request.Repository"></FancyTextBox>
 <br/>
+@* <span>Room alias: </span> *@
+@* <FancyTextBox @bind-Value="@_request."></FancyTextBox> *@
+@* <br/> *@
 
 @if (Constants.Debug) {
     <span>Debug: </span>
     <pre>
-        @request.ToJson()
+        @_request.ToJson()
     </pre>
     <br/>
 }
 
+<LinkButton OnClick="@CreateProject">Create project</LinkButton>
+
 @code {
-    private CreateRoomRequest request = new CreateRoomRequest();
+
+    private BugMineClient? Client { get; set; }
+
+    private readonly ProjectInfo _request = new();
+
+    protected override async Task OnInitializedAsync() {
+        Client = await BugMineStorage.GetCurrentSessionOrNavigate();
+        if (Client == null) {
+            return;
+        }
+    }
+
+    private async Task CreateProject() {
+        if (Client == null) {
+            return;
+        }
+
+        var proj = await Client.CreateProject(_request);
+        NavigationManager.NavigateTo($"/Projects/{proj.ProjectSlug}/");
+    }
 
 }
\ No newline at end of file