Skip to content

Commit

Permalink
load tour from server before cloning or copy json
Browse files Browse the repository at this point in the history
  • Loading branch information
dimmik committed Aug 8, 2023
1 parent e5bac4b commit b80029b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions TCBlazor/Client/Pages/TourListPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,24 @@ else
}
return code;
}
private Task CloneTour(Tour t, bool stripSpendings = false)
private async Task CloneTour(Tour t, bool stripSpendings = false)
{
var cloned = t.SafeClone<Tour>();
var tt = await engine.DataSvc.LoadTour(id: t.Id, onTourAvailable: (_a, _b, _c) => Task.CompletedTask);
var cloned = tt.SafeClone<Tour>();
cloned.Name = $"clone of {t.Name}";
if (stripSpendings)
{
cloned.Spendings.Clear();
}
InProgress = true;
_ = engine.RequestAddTour(cloned, GetCode());
return Task.CompletedTask;
//return Task.CompletedTask;
}
private async Task CopyTourJsonToCb(Tour t)
{
var text = JsonSerializer.Serialize(t, new JsonSerializerOptions()
var tt = await engine.DataSvc.LoadTour(id: t.Id, onTourAvailable: (_a, _b, _c) => Task.CompletedTask);
var text = JsonSerializer.Serialize(tt, new JsonSerializerOptions()
{
WriteIndented = true,
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
Expand Down

0 comments on commit b80029b

Please sign in to comment.