From 380187ee5aadf008c7a71a9015008c155c528ccc Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 22 Jul 2018 03:31:24 -0400 Subject: Update function location() Passing no argument (or NULL) now causes this function to redirect to the 'app-path' (current request page). This is a way to reload the current page. --- app/class/globals.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app/class') diff --git a/app/class/globals.php b/app/class/globals.php index ab82edd..c81c9a2 100644 --- a/app/class/globals.php +++ b/app/class/globals.php @@ -69,11 +69,14 @@ function redirect(string $url) : void /* * Redirect to the given in-app URL and die. The given URL should be a path - * relative to the app root. + * relative to the app root. No argument reloads the current path. */ -function location(string $path) : void +function location(?string $path = NULL) : void { - redirect(ar() . $path); + if ($path) + redirect(ar() . $path); + else + redirect(ap()); } /* -- cgit v1.2.3