bluesky-thinkup-tributewatcher.tsx5 matches
21let follows: any[] = [];
22let cursor: string | undefined = undefined;
23let pagesFetched = 0;
2425let seenDids = new Set();
54// Take time between each page to avoid hammering bluesky too much
55await new Promise(resolve => setTimeout(resolve, 100));
56pagesFetched++;
57console.log(`${pagesFetched} PAGES FETCHED`);
58}
5960console.log(`${pagesFetched} PAGES FETCHED`);
61console.log(`${follows.length} PROFILES FETCHED`);
6263type R = {
31.toString("base64");
3233const response = await fetch(`https://api.switch-bot.com/${path}`, {
34headers: buildSwitchBotHeaders(),
35...args,
20const [isEditing, setIsEditing] = useState(false);
2122// Fetch tests from the API
23const fetchTests = async () => {
24setLoading(true);
25setError(null);
26
27try {
28const response = await fetch("/api/tests", {
29headers: {
30"X-User-ID": userId
37setTests(data.data);
38} else {
39setError(data.error || "Failed to fetch tests");
40}
41} catch (err) {
52
53try {
54const response = await fetch("/api/tests", {
55method: "POST",
56headers: {
82
83try {
84const response = await fetch(`/api/tests/${id}`, {
85method: "PUT",
86headers: {
117
118try {
119const response = await fetch(`/api/tests/${id}`, {
120method: "DELETE",
121headers: {
Job-postingjobs.ts2 matches
11return c.json(jobPostings);
12} catch (error) {
13console.error("Error fetching jobs:", error);
14return c.json({ error: "Failed to fetch job postings" }, 500);
15}
16});
Job-postingindex.tsx17 matches
87};
8889const fetchJobs = async () => {
90try {
91const response = await fetch('/api/jobs');
92if (!response.ok) throw new Error('Failed to fetch jobs');
93jobs = await response.json();
94renderJobs();
95} catch (error) {
96console.error('Error fetching jobs:', error);
97}
98};
126
127try {
128const response = await fetch('/api/jobs', {
129method: 'POST',
130headers: { 'Content-Type': 'application/json' },
138
139// Refresh job listings
140await fetchJobs();
141
142// Add a chat message about the new job
170};
171172const fetchChatMessages = async () => {
173try {
174const response = await fetch('/api/chat');
175if (!response.ok) throw new Error('Failed to fetch chat messages');
176const newMessages = await response.json();
177
184}
185} catch (error) {
186console.error('Error fetching chat messages:', error);
187}
188};
201
202try {
203const response = await fetch('/api/chat', {
204method: 'POST',
205headers: { 'Content-Type': 'application/json' },
226
227// Refresh chat messages
228await fetchChatMessages();
229
230} catch (error) {
244245const startChatPolling = () => {
246// Fetch immediately
247fetchChatMessages();
248
249// Then poll every 3 seconds
250if (chatPollingInterval === null) {
251chatPollingInterval = setInterval(fetchChatMessages, 3000) as unknown as number;
252}
253};
307chatForm.addEventListener("submit", handleChatSubmit);
308
309// Fetch fresh data
310fetchJobs();
311};
312
Job-postingchat.ts2 matches
12return c.json(messages);
13} catch (error) {
14console.error("Error fetching chat messages:", error);
15return c.json({ error: "Failed to fetch chat messages" }, 500);
16}
17});