Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
export const dbCreateCollection = async (newCollectionName) => {
console.log("dbCreateCollection");
let result = await fetch(
"http://127.0.0.1:5000/api/v1/create_collection",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"authenticate":{"username":"test_user","password":"12345"},
"collection_info":{"collection_name": newCollectionName}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
console.log("dbCreateCollection Success")
return response["collection_id"];
}
});
return result
};
export const dbGetCollection = async (collection_id) => {
console.log("dbGetCollection");
let result = await fetch("http://127.0.0.1:5000//api/v1/get_collection?collection=" + collection_id,)
.then((response) => response.json())
.then((response) => {
console.log(response)
if (response["status"] == "success") {
return response["collection"]
}
});
return result;
};
export default dbCreateCollection;