fix: wishlist 404 page
This commit is contained in:
parent
19eb3cc0d3
commit
6838e26f32
3 changed files with 13 additions and 11 deletions
|
@ -770,7 +770,7 @@ class Page
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
public function errorDocument(int $statusCode, object $objectNotFound): void
|
public function errorDocument(int $statusCode, string $fullyQualifiedClass): void
|
||||||
{
|
{
|
||||||
http_response_code($statusCode);
|
http_response_code($statusCode);
|
||||||
|
|
||||||
|
@ -778,7 +778,7 @@ class Page
|
||||||
$this->bodyStart();
|
$this->bodyStart();
|
||||||
$this->navigation();
|
$this->navigation();
|
||||||
|
|
||||||
$class = new \ReflectionClass($objectNotFound);
|
$class = new \ReflectionClass($fullyQualifiedClass);
|
||||||
$className = $class->getShortName();
|
$className = $class->getShortName();
|
||||||
?>
|
?>
|
||||||
<main>
|
<main>
|
||||||
|
|
|
@ -46,12 +46,13 @@ class Wishlist
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (false === $wishlistQuery) {
|
$wishlistData = $wishlistQuery->fetch();
|
||||||
|
|
||||||
|
if (false === $wishlistData) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$wishlistData = $wishlistQuery->fetch();
|
$wishlist = new Wishlist($wishlistData);
|
||||||
$wishlist = new Wishlist($wishlistData);
|
|
||||||
|
|
||||||
return $wishlist;
|
return $wishlist;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,13 @@
|
||||||
|
|
||||||
namespace wishthis;
|
namespace wishthis;
|
||||||
|
|
||||||
$wishlist = Wishlist::getFromHash($_GET['hash']);
|
$wishlist = Wishlist::getFromHash($_GET['hash']);
|
||||||
|
|
||||||
|
if (false === $wishlist) {
|
||||||
|
$page = new Page(__FILE__, 'Wishlist not found');
|
||||||
|
$page->errorDocument(404, Wishlist::class);
|
||||||
|
}
|
||||||
|
|
||||||
$wishlist_user = User::getFromID($wishlist->getUserId());
|
$wishlist_user = User::getFromID($wishlist->getUserId());
|
||||||
$page = new Page(__FILE__, $wishlist->getTitle());
|
$page = new Page(__FILE__, $wishlist->getTitle());
|
||||||
$page->stylesheets['wish'] = 'src/assets/css/wish.css';
|
$page->stylesheets['wish'] = 'src/assets/css/wish.css';
|
||||||
|
@ -16,11 +22,6 @@ $page->stylesheets['wish-card'] = 'src/assets/css/wish-card.css';
|
||||||
$page->scripts['wish'] = 'src/assets/js/parts/wish.js';
|
$page->scripts['wish'] = 'src/assets/js/parts/wish.js';
|
||||||
$page->scripts['wishlist-filter-priority'] = 'src/assets/js/parts/wishlist-filter-priority.js';
|
$page->scripts['wishlist-filter-priority'] = 'src/assets/js/parts/wishlist-filter-priority.js';
|
||||||
$page->scripts['wishlists'] = 'src/assets/js/parts/wishlists.js';
|
$page->scripts['wishlists'] = 'src/assets/js/parts/wishlists.js';
|
||||||
|
|
||||||
if (false === $wishlist) {
|
|
||||||
$page->errorDocument(404, $wishlist);
|
|
||||||
}
|
|
||||||
|
|
||||||
$page->header();
|
$page->header();
|
||||||
$page->bodyStart();
|
$page->bodyStart();
|
||||||
$page->navigation();
|
$page->navigation();
|
||||||
|
|
Loading…
Reference in a new issue