links: [
httpBatchLink({
url: 'http://localhost:3000/trpc',
async headers() {
const token = await opts.getToken();
return {
Authorization: `Bearer ${token}`,
};
},
async fetch(url, options) {
const res = await fetch(url, options);
const json = await res.json();
const errors = json.filter((r: any) => r.error).map((r: any) => r.error.json.message);
console.log(json);
console.log(errors);
// TODO: show error notification
Object.assign(res, { json: () => json });
return res;
},
}),
],
links: [
httpBatchLink({
url: 'http://localhost:3000/trpc',
async headers() {
const token = await opts.getToken();
return {
Authorization: `Bearer ${token}`,
};
},
async fetch(url, options) {
const res = await fetch(url, options);
const json = await res.json();
const errors = json.filter((r: any) => r.error).map((r: any) => r.error.json.message);
console.log(json);
console.log(errors);
// TODO: show error notification
Object.assign(res, { json: () => json });
return res;
},
}),
],