Kinda fix networks
This commit is contained in:
@@ -37,14 +37,14 @@ export const p2privateApi = {
|
||||
},
|
||||
|
||||
async createMessage(from, to, content, medias){
|
||||
const data = {"from":from, "to":to, "content":content, "medias":medias}
|
||||
const data = {"content":content, "medias":medias}
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json',},
|
||||
body: JSON.stringify(data),
|
||||
};
|
||||
try {
|
||||
const response = await fetch(p2privateApiUrl+"/messages", requestOptions);
|
||||
const response = await fetch(p2privateApiUrl+"/messages/"+from+"/"+to, requestOptions);
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`Error fetching posts: ${response.status} - ${errorText}`);
|
||||
@@ -59,6 +59,21 @@ export const p2privateApi = {
|
||||
}
|
||||
},
|
||||
|
||||
async getChat(from, to){
|
||||
try {
|
||||
const response = await fetch(p2privateApiUrl+"/messages/"+from+"/"+to)
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`Error fetching networks: ${response.status} - ${errorText}`);
|
||||
}
|
||||
const result = await response.json()
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error("Error fetching networks:", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
// async createPosts(user, content, medias, networks){
|
||||
// const data = {"user": user, "content": content, "medias": medias, "networks": networks};
|
||||
// const requestOptions = {
|
||||
|
||||
Reference in New Issue
Block a user