Skip to content

Commit

Permalink
Added support for request restore with ajax
Browse files Browse the repository at this point in the history
  • Loading branch information
sallyx committed Nov 6, 2015
1 parent 190f630 commit 30f2ad1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Application/UI/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ public function storeRequest($expiration = '+ 10 minutes')
$key = Nette\Utils\Random::generate(5);
} while (isset($session[$key]));

$session[$key] = [$this->getUser()->getId(), $this->request];
$session[$key] = [$this->getUser()->getId(), $this->request, $this->httpRequest->getUrl()];
$session->setExpiration($expiration, $key);
return $key;
}
Expand All @@ -1110,7 +1110,11 @@ public function restoreRequest($key)
return;
}
$request = clone $session[$key][1];
$url = $session[$key][2];
unset($session[$key]);
if($this->isAjax()) {
$this->redirectUrl($url);
}
$request->setFlag(Application\Request::RESTORED, TRUE);
$params = $request->getParameters();
$params[self::FLASH_KEY] = $this->getParameter(self::FLASH_KEY);
Expand Down

0 comments on commit 30f2ad1

Please sign in to comment.