Remove non-needed pageload object
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
using MistoxWebsite.Server.Services.DatabaseService;
|
||||
using System.Security.Claims;
|
||||
using MistoxWebsite.Server.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace MistoxWebsite.Server.Controllers {
|
||||
[ApiController]
|
||||
public class PageLoad : ControllerBase {
|
||||
|
||||
DatabaseService _databaseService;
|
||||
|
||||
public PageLoad( DatabaseService context ) {
|
||||
_databaseService = context;
|
||||
}
|
||||
|
||||
[Route( "api/pageload" )]
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<PageLoadObject>> onPageLoad() {
|
||||
try {
|
||||
if( User.Identity != null && User.Identity.IsAuthenticated ) {
|
||||
string? id = User.FindFirstValue( "ID" );
|
||||
if( !string.IsNullOrEmpty( id ) ) {
|
||||
PageLoadObject test = await _databaseService.getPageLoadObject(int.Parse(id));
|
||||
if (test.user != null){
|
||||
test.Cart = await _databaseService.GetCart( test.user );
|
||||
if( test != null ) {
|
||||
return test;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NotFound();
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine(e.ToString());
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user