docs: #373 reading list of languges in the editor

This commit is contained in:
Hamid Reza Mohammadi 2023-04-01 16:15:09 +03:30
parent 19fab3ea04
commit 7cbdeae42d

View File

@ -102,6 +102,20 @@ namespace GanjooRazor.Areas.User.Pages
/// </summary>
public PoemGeoDateTag[] PoemGeoDateTags { get; set; }
public GanjoorLanguage[] Languages { get; set; }
private async Task ReadLanguagesAsync(HttpClient secureClient)
{
HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/translations/languages");
if (!response.IsSuccessStatusCode)
{
FatalError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
return;
}
Languages = JsonConvert.DeserializeObject<GanjoorLanguage[]>(await response.Content.ReadAsStringAsync());
}
/// <summary>
/// get
/// </summary>
@ -203,7 +217,9 @@ namespace GanjooRazor.Areas.User.Pages
CanAssignRhythms = false;
}
if(ShowAdminOps)
await ReadLanguagesAsync(secureClient);
if (ShowAdminOps)
{
var responseLocations = await secureClient.GetAsync($"{APIRoot.Url}/api/locations");
if (!responseLocations.IsSuccessStatusCode)