personalShopperkrogerAuth.ts7 matches
57const credentials = btoa(`${this.clientId}:${this.clientSecret}`);
5859const response = await fetch(`${KROGER_BASE_URL}/v1/connect/oauth2/token`, {
60method: "POST",
61headers: {
84const credentials = btoa(`${this.clientId}:${this.clientSecret}`);
8586const response = await fetch(`${KROGER_BASE_URL}/v1/connect/oauth2/token`, {
87method: "POST",
88headers: {
108*/
109async getUserProfile(accessToken: string): Promise<KrogerProfileResponse> {
110const response = await fetch(`${KROGER_BASE_URL}/v1/identity/profile`, {
111headers: {
112Authorization: `Bearer ${accessToken}`,
117if (!response.ok) {
118const errorText = await response.text();
119throw new Error(`Profile fetch failed: ${response.status} ${errorText}`);
120}
121179});
180181const response = await fetch(
182`${KROGER_BASE_URL}/v1/locations?${params.toString()}`,
183{
206locationId: string
207): Promise<KrogerLocationResponse> {
208const response = await fetch(
209`${KROGER_BASE_URL}/v1/locations/${locationId}`,
210{
218if (!response.ok) {
219const errorText = await response.text();
220throw new Error(`Location fetch failed: ${response.status} ${errorText}`);
221}
222
Presentationsindex.ts1 match
76});
7778export default app.fetch;
3738try {
39const response = await fetch('/api/presentations', {
40method: 'POST',
41headers: {
PresentationsPresentationItem.tsx2 matches
4445try {
46const response = await fetch(`/api/presentations/${presentation.id}`, {
47method: 'PUT',
48headers: {
69const confirmRemove = async () => {
70try {
71const response = await fetch(`/api/presentations/${presentation.id}`, {
72method: 'DELETE',
73});
Presentationsindex.tsx7 matches
6import type { Presentation } from "../shared/types.ts";
78// Get initial data from server-side injection or fetch from API
9const getInitialData = (): Presentation[] => {
10if (typeof window !== 'undefined' && (window as any).__INITIAL_DATA__) {
45upcomingPresentationDay.setUTCMilliseconds(0);
4647const fetchPresentations = async () => {
48setLoading(true);
49try {
50const response = await fetch('/api/presentations');
51const data = await response.json();
52setPresentations(data);
53} catch (error) {
54console.error('Error fetching presentations:', error);
55} finally {
56setLoading(false);
5960useEffect(() => {
61// Only fetch if we don't have initial data
62if (presentations.length === 0) {
63fetchPresentations();
64}
65}, []);
70presentations={presentations}
71firstThursday={firstThursday}
72onRefresh={fetchPresentations}
73loading={loading}
74/>
94app.get("/main.js", serve(js, "text/javascript"));
9596export default app.fetch;
townie-testingserveFile.md1 match
71
72// Inject initial data to avoid extra round-trips
73const initialData = await fetchInitialData();
74const dataScript = `<script>
75window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
pineconenew-file-6541.tsx14 matches
4546// Create a quick thread for parsing
47const threadResponse = await fetch("https://api.openai.com/v1/threads", {
48method: "POST",
49headers: {
5859// Add the query
60await fetch(`https://api.openai.com/v1/threads/${thread.id}/messages`, {
61method: "POST",
62headers: {
7273// Run the parser assistant
74const runResponse = await fetch(`https://api.openai.com/v1/threads/${thread.id}/runs`, {
75method: "POST",
76headers: {
99await new Promise(resolve => setTimeout(resolve, 500));
100101const statusResponse = await fetch(
102`https://api.openai.com/v1/threads/${thread.id}/runs/${run.id}`,
103{
113114// Get the response
115const messagesResponse = await fetch(
116`https://api.openai.com/v1/threads/${thread.id}/messages?order=desc&limit=1`,
117{
591}
592593// Create or retrieve thread using raw fetch with v2 headers
594let thread;
595if (threadId) {
596const threadResponse = await fetch(`https://api.openai.com/v1/threads/${threadId}`, {
597headers: baseHeaders,
598});
602thread = await threadResponse.json();
603} else {
604const threadResponse = await fetch("https://api.openai.com/v1/threads", {
605method: "POST",
606headers: baseHeaders,
627628// Add message to thread with v2 headers
629const messageResponse = await fetch(`https://api.openai.com/v1/threads/${thread.id}/messages`, {
630method: "POST",
631headers: baseHeaders,
641642// Run the assistant with v2 headers
643const runResponse = await fetch(`https://api.openai.com/v1/threads/${thread.id}/runs`, {
644method: "POST",
645headers: baseHeaders,
862};
863864// Poll for completion using raw fetch with v2 headers
865let runStatus = run;
866let allMediaDisplays = [];
875await new Promise(resolve => setTimeout(resolve, 2000));
876877const statusResponse = await fetch(
878`https://api.openai.com/v1/threads/${thread.id}/runs/${run.id}`,
879{ headers: baseHeaders },
904905// Submit tool outputs with v2 headers
906const toolOutputResponse = await fetch(
907`https://api.openai.com/v1/threads/${thread.id}/runs/${run.id}/submit_tool_outputs`,
908{
928929// Get the assistant's response with v2 headers
930const messagesResponse = await fetch(
931`https://api.openai.com/v1/threads/${thread.id}/messages?order=desc&limit=20`,
932{ headers: baseHeaders },