WIP PWA for Grain
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use authenticated client for queries to populate viewer fields

+8
+8
src/services/grain-api.js
··· 1 1 import { config } from '../config.js'; 2 2 import { recordCache } from './record-cache.js'; 3 3 import { queryCache } from './query-cache.js'; 4 + import { auth } from './auth.js'; 4 5 5 6 class GrainApiService { 6 7 #endpoint = config.apiEndpoint; ··· 221 222 } 222 223 223 224 async #execute(query, variables = {}) { 225 + // Use authenticated client if available for viewer fields 226 + if (auth.isAuthenticated) { 227 + const client = auth.getClient(); 228 + const data = await client.query(query, variables); 229 + return { data }; 230 + } 231 + 224 232 const response = await fetch(this.#endpoint, { 225 233 method: 'POST', 226 234 headers: {