MCPcopy Create free account
hub / github.com/featureform/featureform / useDataAPI

Function useDataAPI

dashboard/src/hooks/dataAPI.js:18–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16}
17
18export function useDataAPI() {
19 const getTags = async (type = '', resourceName = '', variant = '') => {
20 const address = `${API_URL}/data/${type}/${resourceName}/gettags`;
21 const result = await fetch(address, {
22 method: 'POST',
23 headers: {
24 'Content-Type': 'application/json',
25 },
26 body: JSON.stringify({ variant: variant }),
27 })
28 .then((res) => res.json())
29 .catch((error) => {
30 console.error(error);
31 return error;
32 });
33 return result;
34 };
35
36 const postTags = async (
37 type = '',
38 resourceName = '',
39 variant = '',
40 tagList = []
41 ) => {
42 const address = `${API_URL}/data/${type}/${resourceName}/tags`;
43 const result = await fetch(address, {
44 method: 'POST',
45 headers: {
46 'Content-Type': 'application/json',
47 },
48 body: JSON.stringify({ tags: tagList, variant: variant }),
49 })
50 .then((res) => res.json())
51 .catch((error) => {
52 console.error(error);
53 return error;
54 });
55 return result;
56 };
57
58 const getTasks = async (searchParams = {}) => {
59 const result = await fetch(`${API_URL}/data/tasks`, {
60 cache: 'no-store',
61 method: 'POST',
62 headers: {
63 'Content-Type': 'application/json',
64 },
65 body: JSON.stringify(searchParams),
66 })
67 .then((res) => res.json())
68 .catch((error) => {
69 console.error('Error fetching tasks from server: ', error);
70
71 return [];
72 });
73
74 return result;
75 };

Callers 2

TagBox.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected