File size: 546 Bytes
0a2f730
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { API_ENDPOINT, SEARCH_ENDPOINT, VISUALIZATION_ENDPOINT } from './config.js';

export async function fetchRecommendations(title) {
  const response = await fetch(`${API_ENDPOINT}?title=${encodeURIComponent(title)}`);
  return response.json();
}

export async function fetchAutocomplete(query) {
  const response = await fetch(`${SEARCH_ENDPOINT}?q=${encodeURIComponent(query)}`);
  return response.json();
}

export async function fetchVisualizations() {
  const response = await fetch(VISUALIZATION_ENDPOINT);
  return response.json();
}