Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Daniel Corn
@cundd
but DI is nicer
baggyownz
@baggyownz
okay
now i got "null" as response
Daniel Corn
@cundd
can you check if the route was called?
E.g. var_dump something
baggyownz
@baggyownz
i get the given identifier
Daniel Corn
@cundd
try return json_encode($model)
maybe you found something that could be improved in the extension
baggyownz
@baggyownz
{"message":"{}"}
Daniel Corn
@cundd
  if (!$model) {
                        return $this->responseFactory->createErrorResponse(
                            'The model was not found',
                            404,
                            $request
                        );
                    } else {
                        return $this->responseFactory->createSuccessResponse(
                            json_encode($model),
                            200,
                            $request
                        );
                    }
and implement JsonSerializable for your Model
then you should be fine
baggyownz
@baggyownz
oh man..
some other things damaged now..
i'll fix that first and then get back to you. thanks first of all
Daniel Corn
@cundd
oh thats not good :-S
baggyownz
@baggyownz
sooo..
first problem is fixed.
but the model is still empty
i looked at the query and that's ok
Daniel Corn
@cundd
Can you try it like this:
$extractor = $this->objectManager->get(\Cundd\Rest\DataProvider\ExtractorInterface::class);

return $this->responseFactory->createSuccessResponse(
    $extractor->extract($model),
    200,
    $request
);
baggyownz
@baggyownz
uhhh.. at first view it looks good
Daniel Corn
@cundd
my first suggestion was wrong too ;)
baggyownz
@baggyownz
:D
sometimes its tricky
Daniel Corn
@cundd
Good that it's already friday :D
baggyownz
@baggyownz
yep
baggyownz
@baggyownz
can i add also multiple parameters?
baggyownz
@baggyownz
or can i exclude fields in the result?
Daniel Corn
@cundd
you can still implement JsonSerializable and return only the public fields
and you can add additional parameters
you than have to customize the route
baggyownz
@baggyownz
aaah i got it
thanks
(public fields)
baggyownz
@baggyownz
thanks again and a nice weekend
Daniel Corn
@cundd
you too :)
Maurizio Morini
@emmemme

Hi Daniel, I'm trying to use cundd/rest to access authentication but I've problems with OPTIONS request.
If I call

curl -X GET https://job.vue.typo395.ddev.site/rest/auth/login
{"status":"logged-out"}

the respons is ok, but if I call

curl -X OPTIONS https://job.vue.typo395.ddev.site/rest/auth/login
{"error":"Not Found"}

the response is 404
I've the the same result when I call the url in my vue application.
Now I'm using the cundd/rest:v4.x-dev but I had the same results with cundd/rest:3.6
I know I'm doing something wrong... and I need a clue...

Daniel Corn
@cundd
Hi @emmemme
No, I think your doing nothing wrong. There is no OPTIONS route defined for the Auth Handler
Maurizio Morini
@emmemme
And I can create the route with a custom handler?
Daniel Corn
@cundd
Yes. Or you give me a second to fix it ;)
Maurizio Morini
@emmemme
In the mean time I'll create a custom handler, or when you talk about second you mean a couple of days?
Daniel Corn
@cundd
no just a view minutes :)
Maurizio Morini
@emmemme
Great, when published, I'll find the update on cundd/rest:v4.x-dev?
Daniel Corn
@cundd
Yes exactly
unless you really need to use version 3
Maurizio Morini
@emmemme
For me the 4v is ok
Daniel Corn
@cundd
I pushed the update to the server
Maurizio Morini
@emmemme
Thanks a lot... wonderful. thank again. :+1:
Daniel Corn
@cundd
Could you already test it? Does it work fine?
Maurizio Morini
@emmemme
Yes, it's work. I tested the post call to login and I got back the {"status":"logged-in"} message. Now I'll continue to test nuxt.js and TYPO3 together... Experimental!
Daniel Corn
@cundd
Interesting. I've never heard of nuxt.js before. But I'm using React lately
Maurizio Morini
@emmemme
I'm at the beginnig to explore the pwa development. When I've start to look around, I evaluated to use Reach which is very popular... but I don't like its mode to mix code with HTML. So I saw that vue.js have a large community and lot of features and options (like nuxt.js). Now I'm trying to create a dashboard with fe_users authentication... to arrive to create a pwa...
kobbe82
@kobbe82
Hi, is it possible to get a subset of the pages? With /rest/page I get the whole tree. With /rest/page/123 I only get a single page. I would like to get 123 and all it's subpages.
Daniel Corn
@cundd
@kobbe82 its not possible at the moment, but it could be added as feature to https://rest.corn.rest/_Initiatives/Headless/