My saga.ts :
export function* postSomething(object:object){
yield postRequest(object);
const Objects=yield getRequest();
console.log(Objects);
yield put(showObject(Objects));
}
**db.json is my little database
My db.json is empty at the beginning, and after first postRequest(object), db.json will have one object,but when I try to get that object with getRequest I get [ ] (empty array)!?Why?
My console.log(Object) doesn't print anything.
Next time when I do postRequest(object) and post to my db.json one more object, that means db.json will have two objects, but after that, when I try to pull objects with getRequest(), my console.log print only one object?Why?
How to get all objects from db.json after postRequest() ?
postRequest(object)(post object to db.json using fetch,method "post") is service function which communicate with db.json,
getRequest()( fetch(url) which need to return all object from db.json ) .