bsusta / lanhelpdesk-nasadenie

0 stars 0 forks source link

Prijatie dat po pridani niecoho #78

Open ladislavbili opened 7 years ago

ladislavbili commented 7 years ago

Doteraz mi to fungovalo normalne, dostal som response, zavolal som response.json() a dostal som json subor. Momentalne som ale narazil na problem, ktory neviem ci som jediny kto ho ma, preto som pridal aj Juraja.

Na tento problém som narazil, ked som tasku pridal invoiceable item, vratilo mi to odpoved, ktora mi nesla dekodovat (doteraz sla uz nejde z nicoho nic), no item bol uspesne pridany: { type: 'default', 10-28 13:28:45.575 5931 6203 I ReactNativeJS: status: 201, 10-28 13:28:45.575 5931 6203 I ReactNativeJS: ok: true, 10-28 13:28:45.575 5931 6203 I ReactNativeJS: statusText: undefined, 10-28 13:28:45.575 5931 6203 I ReactNativeJS: headers: 10-28 13:28:45.575 5931 6203 I ReactNativeJS: { map: 10-28 13:28:45.575 5931 6203 I ReactNativeJS: { 'content-type': [ 'application/json' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: 'content-length': [ '2413' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: connection: [ 'Keep-Alive' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: 'x-debug-token-link': [ 'https://dev.lanhelpdesk.com/_profiler/3fbb42' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: 'x-debug-token': [ '3fbb42' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: 'cache-control': [ 'no-cache, private' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: server: [ 'Apache/2.4.10 (Debian)' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: 'keep-alive': [ 'timeout=5, max=100' ], 10-28 13:28:45.575 5931 6203 I ReactNativeJS: date: [ 'Sat, 28 Oct 2017 13:45:47 GMT' ] } }, 10-28 13:28:45.575 5931 6203 I ReactNativeJS: url: 'https://dev.lanhelpdesk.com/api/v1/task-bundle/tasks/72106/invoiceable-items/unit/86', 10-28 13:28:45.575 5931 6203 I ReactNativeJS: _bodyInit: 'ProcessEntity.php on line 52:\nSymfony\\Component\\Validator\\ConstraintViolationList {#1198\n -violations: []\n}\n{"da ta":{"id":72106,"title":"task z mobilu xxx","description":"popis ulohy z mobilu","deadline":64082790000,"startedAt":null,"closedAt":null,"important":true,"work":"nic","work_time":"41 ","createdAt":1508259475,"updatedAt":1508259475,"createdBy":{"id":2410,"username":"admin","email":"admin@admin.sk","name":"Admin","surname":"Adminovic"},"requestedBy":{"id":2410,"use rname":"admin","email":"admin@admin.sk","name":"Admin","surname":"Adminovic"},"project":{"id":160,"title":"Project of admin","is_active":true},"company":[],"taskData":[],"followers": [],"tags":[],"taskHasAssignedUsers":[],"taskHasAttachments":[],"comments":[],"invoiceableItems":[{"id":62,"title":"aaave","amount":"50.00","unit_price":"20.00","unit":{"id":85,"title ":"Kus","shortcut":"Ks"}},{"id":70,"title":"a","amount":"0.00","unit_price":"0.00","unit":{"id":86,"title":"Centimeter","shortcut":"cm"}},{"id":71,"title":"a","amount":"0.00","unit_p rice":"0.00","unit":{"id":86,"title":"Centimeter","shortcut":"cm"}},{"id":72,"title":"vc","amount":"0.00","unit_price":"0.00","unit":{"id":86,"title":"Centimeter","shortcut":"cm"}},{ "id":73,"title":"er","amount":"0.00","unit_price":"0.00","unit":{"id":86,"title":"Centimeter","shortcut":"cm"}},{"id":74,"title":"mb","amount":"0.00","unit_price":"0.00","unit":{"id" :86,"title":"Centimeter","shortcut":"cm"}},{"id":75,"title":"novy item","amount":"1","unit_price":"1","unit":{"id":86,"title":"Centimeter","shortcut":"cm"}}],"canEdit":true,"follow": false,"hasProject":true,"loggedUserIsAdmin":true,"loggedUserProjectAcl":["view_own_tasks","view_tasks_from_users_company","view_all_tasks","create_task","resolve_task","delete_task", "view_internal_note","edit_internal_note","edit_project"],"loggedUserRoleAcl":["login_to_system","share_filters","project_shared_filters","report_filters","share_tags","create_projec ts","sent_emails_from_comments","create_tasks","create_tasks_in_all_projects","update_all_tasks","user_settings","user_role_settings","company_attribute_settings","company_settings", "status_settings","task_attribute_settings","unit_settings","system_settings","smtp_settings","imap_settings"]},"_links":{"quick update: task":"\\/api\\/v1\\/task-bundle\\/tasks\\/qu ick-update\\/72106","patch: task":"\\/api\\/v1\\/task-bundle\\/tasks\\/72106","delete":"\\/api\\/v1\\/task-bundle\\/tasks\\/72106"}}', 10-28 13:28:45.575 5931 6203 I ReactNativeJS: _bodyText: 'ProcessEntity.php on line 52:\nSymfony\\Component\\Validator\\ConstraintViolationList {#1198\n -violations: []\n}\n{"da ta":{"id":72106,"title":"task z mobilu xxx","description":"popis ulohy z mobilu","deadline":64082790000,"startedAt":null,"closedAt":null,"important":true,"work":"nic","work_time":"41 ","createdAt":1508259475,"updatedAt":1508259475,"createdBy":{"id":2410,"username":"admin","email":"admin@admin.sk","name":"Admin","surname":"Adminovic"},"requestedBy":{"id":2410,"use rname":"admin","email":"admin@admin.sk","name":"Admin","surname":"Adminovic"},"project":{"id":160,"title":"Project of admin","is_active":true},"company":[],"taskData":[],"followers": [],"tags":[],"taskHasAssignedUsers":[],"taskHasAttachments":[],"comments":[],"invoiceableItems":[{"id":62,"title":"aaave","amount":"50.00","unit_price":"20.00","unit":{"id":85,"title ":"Kus","shortcut":"Ks"}},{"id":70,"title":"a","amount":"0.00","unit_price":"0.00","unit":{"id":86,"title":"Cent viac mi react konzola z toho nevypise... a errory ktore vyvolava: ``` SyntaxError: Unexpected token P in JSON at position 0 at parse () at tryCallOne (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\promise\setimmediate\core.js:37) at D:\Praca\Momentalne\HelpdeskAppRest\node_modules\promise\setimmediate\core.js:123 at D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:262 at _callTimer (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:143) at Object.callImmediatesPass (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:443) at Object.callImmediates (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\Core\Timers\JSTimers.js:459) at MessageQueue.callImmediates (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:244) at D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:128 at MessageQueue.guard (D:\Praca\Momentalne\HelpdeskAppRest\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:231)


a v konzole `{ [SyntaxError: JSON Parse error: Unexpected identifier "ProcessEntity"]
line: 11597,
column: 14,
'http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false' }`

Typujem ze to referuje na fakt, ze v body dostanem aj nieco ako ` _bodyInit: 'ProcessEntity.php on line 52:\nSymfony\\Component\\Validator\\ConstraintViolationList {#1198\n  -violations: []\n}\n{"da
ta":`

Ak to je pridane cez online API tak to normalne dekoduje ale ked sa to snazim precitat cez json() tak to pada
Corrigan14 commented 7 years ago

nerozumiem uplne - cize funkcionalita je OK, ale response nejde odkodovat kvoli tym Invoiceable item? V stredu mozem skontrolovat navratove hodnoty.

ladislavbili commented 7 years ago

Takto, funkcionalita vsetkeho je zatial dobra. Len odpovede po pridani mi zrazu prestali fungovat. Nerobia to len invoicable-items, robia to aj kommenty, aj firmy... Vrati sa json, ktory sa neda odkodovat, netusim preco. Doteraz to fungovalo bez problemov, ked volam GET tak to odkodujem bez problemov, aj prihlasovaci POST, len ked pridam nieco nove, nejde to odkodovat.

Ked ale uplne rovnake pridanie zavolam na Dokumentácii API, tak funguje. Preto som pridal aj Juraja ci aj na webe čo robí vyskytol tento problém. Ak by si mohla, skus sa prosim pozriet ci sa v tych odpovediach nieco nezmenilo. Mam pocit ze odpovede z API zacali obsahovat nejaku ProcessEntity, ktoru nevie json precitat. Pri vsetkych mam totiz vzdy rovnaky error

Unexpected identifier "ProcessEntity"

Corrigan14 commented 7 years ago

Uf... tak toto skor vyzera, ze je chyba u Teba.. lebo API principialne po POST-e a GET-e vracia presne tie iste data (volam na to rovnaku funkciu) .. tak neviem pozriem sa ale skus este TY pohladat ci si nieco nezmenil.