mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
Revert "better error codes for set url"
This reverts commit ceea727d12.
This commit is contained in:
parent
ceea727d12
commit
4c3e219815
1 changed files with 2 additions and 5 deletions
|
|
@ -8,7 +8,6 @@ use Demostf\API\Demo\DemoStore;
|
||||||
use Demostf\API\Providers\ChatProvider;
|
use Demostf\API\Providers\ChatProvider;
|
||||||
use Demostf\API\Providers\DemoListProvider;
|
use Demostf\API\Providers\DemoListProvider;
|
||||||
use Demostf\API\Providers\DemoProvider;
|
use Demostf\API\Providers\DemoProvider;
|
||||||
use Flight;
|
|
||||||
use flight\net\Request;
|
use flight\net\Request;
|
||||||
use flight\net\Response;
|
use flight\net\Response;
|
||||||
use function intval;
|
use function intval;
|
||||||
|
|
@ -127,8 +126,7 @@ class DemoController extends BaseController {
|
||||||
$url = (string) $this->post('url', '');
|
$url = (string) $this->post('url', '');
|
||||||
$editKey = (string) $this->post('key', '');
|
$editKey = (string) $this->post('key', '');
|
||||||
if ($editKey !== $this->editKey || '' === $editKey) {
|
if ($editKey !== $this->editKey || '' === $editKey) {
|
||||||
Flight::response()->status(401)->write('Invalid key')->send();
|
throw new InvalidArgumentException('Invalid key');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$demo = $this->demoProvider->get((int) $id);
|
$demo = $this->demoProvider->get((int) $id);
|
||||||
|
|
@ -140,8 +138,7 @@ class DemoController extends BaseController {
|
||||||
$this->store->remove($demo);
|
$this->store->remove($demo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Flight::response()->status(412)->write('Invalid demo hash')->send();
|
throw new InvalidArgumentException('Invalid demo hash');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue