Skip to content

Commit

Permalink
Fixed issues with pages loading or reloading. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGershony authored Dec 1, 2023
1 parent 4062a74 commit 24cc58a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/Angor/Client/Pages/Founder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
StateHasChanged();
},
founderProjectsToLookup.ToArray());
else
scanningForProjects = false;
}

private void NavigateToCreateProject()
Expand Down
30 changes: 16 additions & 14 deletions src/Angor/Client/Pages/Invest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@

@if (founder)
{
<p>You are founder.</p>
<p>You are the founder.</p>
return;
}

@if(project == null)
{
<p>The project was not found.</p>
return;
}

Expand Down Expand Up @@ -197,7 +203,7 @@
private List<StageBreakdown> StagesBreakdown { get; set; } = new();
bool founder = false;
bool invested = false;
private ProjectInfo project;
private ProjectInfo? project;
private bool showCreateModal;
Transaction? signedTransaction;
Transaction unSignedTransaction;
Expand Down Expand Up @@ -231,17 +237,11 @@
if (findProject != null)
{
founder = true;
invested = true;
project = findProject;
}
else
{
findProject = SessionStorage.GetProjectById(ProjectId);

if (findProject != null)
{
project = findProject;
}
project = SessionStorage.GetProjectById(ProjectId);
}
}
}
Expand All @@ -251,7 +251,7 @@
UpdateStagesBreakdown(new ChangeEventArgs { Value = Investment.InvestmentAmount });


if (recoverySigs?.Signatures.Any() ==false)
if (project != null && recoverySigs?.Signatures.Any() ==false)
{
var accountInfo = storage.GetAccountInfo(_networkConfiguration.GetNetwork().Name);

Expand Down Expand Up @@ -303,7 +303,7 @@
StagesBreakdown.Clear();
int index = 1;

foreach (var stage in project.Stages)
foreach (var stage in project!.Stages)
{
var insert = new StageBreakdown
{
Expand Down Expand Up @@ -344,9 +344,11 @@
return;
}

var projects = storage.GetInvestmentProjects();
var signatures = storage.GetSignaturess();

if (projects.Any(a => project.ProjectIdentifier == a.ProjectIdentifier))
recoverySigs = signatures?.FirstOrDefault(_ => _.ProjectIdentifier == project.ProjectIdentifier);

if (recoverySigs?.Signatures.Any() ?? false)
{
notificationComponent.ShowErrorMessage("You already invested");
return;
Expand Down Expand Up @@ -419,7 +421,7 @@
// remove signatures when requesting founder to sign
recoverySigs = new()
{
ProjectIdentifier = project.ProjectIdentifier,
ProjectIdentifier = project!.ProjectIdentifier,
SignedTransactionHex = signedTransaction!.ToHex()
};

Expand Down

0 comments on commit 24cc58a

Please sign in to comment.