<?php

use MintyPHP\Support\Flash;
use MintyPHP\Http\Request;
use MintyPHP\Router;

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
  Router::redirect('');
}

$flashId = isset($id) ? trim((string) $id) : '';
if ($flashId !== '') {
  Flash::dismiss($flashId);
}

$target = Request::safeReturnTarget($_POST['return'] ?? '');
Router::redirect($target);
