dynamic rendering from REST call
This commit is contained in:
parent
9d20919f2c
commit
539221c456
@ -1,12 +1,11 @@
|
|||||||
public class Component {
|
public class Component {
|
||||||
public int Type {get; set;}
|
public int Type {get; set;}
|
||||||
public string Text {get; set;}
|
public string Text {get; set;}
|
||||||
public List<Stats> Chart {get; set;}
|
|
||||||
|
|
||||||
|
|
||||||
public Component(int type, string text="", List<Stats> chart = null){
|
public Component(int type, string text){
|
||||||
Type = type;
|
Type = type;
|
||||||
Text = text;
|
Text = text;
|
||||||
Chart = chart;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3
src/PanoptesFrontend/Data/Schema.cs
Normal file
3
src/PanoptesFrontend/Data/Schema.cs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
public class Schema {
|
||||||
|
public Component[] components {get; set;}
|
||||||
|
}
|
||||||
@ -14,16 +14,16 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public List<Component> data;
|
private Component[] data;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var response = await httpClient.GetAsync("http://localhost:8080");
|
var response = await httpClient.GetStringAsync("http://localhost:8080/schema");
|
||||||
var json = await response.Content.ReadAsStringAsync();
|
var options = new JsonSerializerOptions {PropertyNameCaseInsensitive = true};
|
||||||
data = JsonSerializer.Deserialize<List<Component>>(json);
|
var json = JsonSerializer.Deserialize<Schema>(response, options);
|
||||||
|
data = json.components;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user