182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
338 url.searchParams.append("key", apiKey);
339
340 const response = await fetch(url.toString());
341
342 if (!response.ok) {
8
9 useEffect(() => {
10 fetchTodos();
11 }, []);
12
13 const fetchTodos = async () => {
14 const response = await fetch("/todos");
15 const data = await response.json();
16 setTodos(data);
21 if (!newTodo.trim()) return;
22
23 const response = await fetch("/todos", {
24 method: "POST",
25 headers: { "Content-Type": "application/json" },
29 if (response.ok) {
30 setNewTodo("");
31 fetchTodos();
32 }
33 };
34
35 const toggleTodo = async (id, completed) => {
36 const response = await fetch(`/todos/${id}`, {
37 method: "PATCH",
38 headers: { "Content-Type": "application/json" },
41
42 if (response.ok) {
43 fetchTodos();
44 }
45 };
46
47 const deleteTodo = async (id) => {
48 const response = await fetch(`/todos/${id}`, {
49 method: "DELETE",
50 });
51
52 if (response.ok) {
53 fetchTodos();
54 }
55 };
51
52 try {
53 const response = await fetch('/', {
54 method: 'POST',
55 headers: { 'Content-Type': 'application/json' },
1import cheerio from "https://esm.sh/cheerio@1.0.0-rc.12";
2
3async function fetchJobCount(url: string): Promise<{ count: number; month: string; year: string } | null> {
4 try {
5 const response = await fetch(url);
6 if (!response.ok) {
7 console.error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
8 return null;
9 }
20 return { count, month, year };
21 } catch (error) {
22 console.error(`Error fetching ${url}:`, error);
23 return null;
24 }
55
56 for (const url of urls) {
57 const result = await fetchJobCount(url);
58 if (result) {
59 console.log(`${result.count} jobs, ${result.month} ${result.year}`);
282
283 try {
284 // Fetch channel contents from Are.na API
285 const response = await fetch(`https://api.are.na/v2/channels/${slug}`);
286 const data = await response.json();
287
336 });
337 } catch (error) {
338 return new Response(`Error fetching channel: ${error.message}`, { status: 500 });
339 }
340}
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({
182
183 try {
184 const response = await fetch("/", {
185 method: "POST",
186 body: JSON.stringify({