This commit is contained in:
Roman 2024-05-02 15:21:08 +02:00
parent c4037684ba
commit 8f4650227f
2 changed files with 4 additions and 3 deletions

@ -30,7 +30,7 @@ class DocumentRoute extends Route {
protected function readExtra() {
parent::readExtra();
$this->args = json_decode($this->extra) ?? [];
$this->args = json_decode($this->extra, true) ?? [];
}
public function preInsert(array &$row) {

@ -82,7 +82,8 @@ export default function RouteEditView(props) {
const onSave = useCallback(() => {
if (!isSaving) {
setSaving(true);
let args = [route.pattern, route.type, route.target, route.extra, route.exact, route.active];
let extra = ["dynamic", "static"].includes(route.type) ? route.extra : "";
let args = [route.pattern, route.type, route.target, extra, route.exact, route.active];
if (isNewRoute) {
api.addRoute(...args).then(res => {
setSaving(false);
@ -123,7 +124,7 @@ export default function RouteEditView(props) {
<RouteForm route={route} setRoute={setRoute} />
<ButtonBar mt={2}>
<Button startIcon={<KeyboardArrowLeft />}
variant={"outlined"}
variant={"outlined"} color={"error"}
onClick={() => navigate("/admin/routes")}>
{L("general.cancel")}
</Button>