|
|
@ -10,6 +10,7 @@ using ChoETL;
|
|
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
|
|
using Blazor.Modals;
|
|
|
|
using Blazor.Modals;
|
|
|
|
using Blazored.Modal;
|
|
|
|
using Blazored.Modal;
|
|
|
|
|
|
|
|
using Blazor.Pages.Admins;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Blazor.Pages.Questions;
|
|
|
|
namespace Blazor.Pages.Questions;
|
|
|
|
|
|
|
|
|
|
|
@ -85,12 +86,12 @@ public partial class Questions
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// When you use a real API, we use this follow code
|
|
|
|
// When you use a real API, we use this follow code
|
|
|
|
//var response = await Http.GetFromJsonAsync<ChaptersModel[]>( $"https://trusting-panini.87-106-126-109.plesk.page/api/chapters?page={e.Page}&pageSize={e.PageSize}" );
|
|
|
|
//var response = await Http.GetJsonAsync<Item[]>( $"http://my-api/api/data?page={e.Page}&pageSize={e.PageSize}" );
|
|
|
|
var response = Http.GetFromJsonAsync<Question[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters").Result;
|
|
|
|
var response = (await Http.GetFromJsonAsync<Question[]>($"{NavigationManager.BaseUri}fake-question.json")).Skip((e.Page - 1) * e.PageSize).Take(e.PageSize).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
|
|
if (!e.CancellationToken.IsCancellationRequested)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
totalQuestion = (await LocalStorage.GetItemAsync<List<Question>>("data")).Count;
|
|
|
|
totalQuestion = (await Http.GetFromJsonAsync<List<Question>>($"{NavigationManager.BaseUri}fake-question.json")).Count;
|
|
|
|
questions = new List<Question>(response); // an actual data for the current page
|
|
|
|
questions = new List<Question>(response); // an actual data for the current page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|