-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simple-crud writes data but does not show it #95
Comments
Hi, I ran into the same problem like yours. It turns out to be the problem of my model definition. The task should have one important attribute: active, which should be int type and has default value 1. Otherwise no record will be shown. |
Thanks, zhuzhouliang! I´ll try this. However, active should be defaulted to 1. |
Hi, I encountered the same problem and now I got the 'active' attribute should be 1. I put a record like below into db.json
routes.js
And started json server
Although the data was shown at first, It disappeared after I modified the id:1 record on the browser.
How to avoid this and set 1 into active filed? I appreciate your kindness |
For testing purposes I created a json-file db.json with no data like this:
{ "tasks": [ { } ] }
I also created a file routes.json
{ "/api/demo/tasks": "/tasks" }
I than started a json api server with
json-server db.json
on default port 3000I changed 'url:' in api.js to
url: 'http://127.0.0.1:3000'
and ran vue-crud (simple-crud) bynpn run serve
The vue-crud page displays with no errors. I add a record with the + symbol, the json-server accepts it with 201 and
POST /api/demo/tasks 201 27.237 ms - 92
. The db.json file got the record as expected:{ "tasks": [ { "name": "test", "description": "this is a test record", "apiId": "demo", "id": 1 } ] }
The problem is, that vue-crud does not show this (or any) record. Refreshing does not help, the list stays beeing empty.
The text was updated successfully, but these errors were encountered: