我正在使用ra-postgraphile作为react-admin项目的数据提供者,我需要拦截错误api响应。是否有任何错误对象或函数可用?如果是,我可以获取文档吗?
也在ra-postgraphile repo中发布了一个问题。
源代码
const httpLink = createHttpLink({
uri: Config.postgraphileUrl
});
const authLink = setContext((_, { headers }) => ({
headers: {
...headers,
authorization: token ? `Bearer ${token}` : '',
'Content-Type': 'application/json'
}
}));
const client = new ApolloClient({
link: authLink.concat(httpLink),
cache: new InMemoryCache()
});
useEffect(() => {
(async () => {
const dataProvider = await pgDataProvider(client);
setDataProvider(() => dataProvider);
})();
}, []);