apicase/core

Хук done() не модифицирует result

Closed this issue · 1 comments

const ApiRoot = new ApiService(fetch, {
  url: `${config.url}:${config.apiPort}/api`,
  hooks: {
    done({ next, result, meta: { onlyBody } }) {
      const data = onlyBody ? result.body : result;
      next(data);
    },
  },
  meta: { onlyBody: true },
});

const TagsService = ApiRoot.extend();

const getTags = () => {
  return TagsService.doRequest({
    url: 'tags',
    method: 'GET',
  }).then(newResult => {
    // newResult выводит результат, который был до вызова хука
    console.log('newResult', newResult);
  });
};

done hook was working well but Apicase tried to merge result instead of just changing.
Now it works correctly. Please, update core to @0.11.0 version