mirror of
https://github.com/logos-messaging/logos-messaging-frontend.git
synced 2026-01-05 23:33:07 +00:00
initial bux fixes
This commit is contained in:
parent
1e176113d0
commit
a754e731ae
@ -66,7 +66,7 @@ your-domain.com {
|
|||||||
## Depend APIs
|
## Depend APIs
|
||||||
|
|
||||||
- /relay/v1/auto/messages
|
- /relay/v1/auto/messages
|
||||||
- /store/v1/messages
|
- /store/v3/messages
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "ferry-chat",
|
"name": "waku-frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ferry-chat",
|
"name": "waku-frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-dialog": "^1.0.5",
|
"@radix-ui/react-dialog": "^1.0.5",
|
||||||
|
|||||||
22
src/App.tsx
22
src/App.tsx
@ -20,7 +20,7 @@ import logo from "./assets/logo-waku.svg";
|
|||||||
|
|
||||||
interface Message {
|
interface Message {
|
||||||
payload: string;
|
payload: string;
|
||||||
contentTopic: string;
|
content_topic: string;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,12 +38,18 @@ interface ResponseData {
|
|||||||
cursor?: Cursor;
|
cursor?: Cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface MessageData {
|
||||||
|
message: Message;
|
||||||
|
message_hash: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface CommunityMetadata {
|
interface CommunityMetadata {
|
||||||
name: string;
|
name: string;
|
||||||
contentTopic: string;
|
contentTopic: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SERVICE_ENDPOINT = "https://waku.whisperd.tech";
|
// const SERVICE_ENDPOINT = process.env.API_ENDPOINT || "http://localhost:8645";
|
||||||
|
const SERVICE_ENDPOINT = "http://localhost:8645";
|
||||||
const COMMUNITY_CONTENT_TOPIC_PREFIX = "/universal/1/community";
|
const COMMUNITY_CONTENT_TOPIC_PREFIX = "/universal/1/community";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@ -98,17 +104,19 @@ function App() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = `${apiEndpoint}/store/v1/messages?contentTopics=${joinedContentTopics}&ascending=false&pageSize=300`;
|
let url = `${apiEndpoint}/store/v3/messages?contentTopics=${encodeURIComponent(joinedContentTopics)}&ascending=false&pageSize=300&includeData=true`;
|
||||||
const response = await axios.get(url);
|
const response = await axios.get(url);
|
||||||
console.log("Data:", response.data);
|
console.log("Data:", response.data);
|
||||||
|
|
||||||
|
const parsedResponse = response.data.messages.map((obj: MessageData) => obj.message);
|
||||||
|
|
||||||
setMessages((prev) => {
|
setMessages((prev) => {
|
||||||
const filtered = response.data.messages.filter((msg: Message) => {
|
const filtered = parsedResponse.filter((msg: Message) => {
|
||||||
const found = prev.find(
|
const found = prev.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.payload === msg.payload &&
|
item.payload === msg.payload &&
|
||||||
item.timestamp === msg.timestamp &&
|
item.timestamp === msg.timestamp &&
|
||||||
item.contentTopic === msg.contentTopic
|
item.content_topic === msg.content_topic
|
||||||
);
|
);
|
||||||
return !found;
|
return !found;
|
||||||
});
|
});
|
||||||
@ -136,7 +144,7 @@ function App() {
|
|||||||
(item) =>
|
(item) =>
|
||||||
item.payload === msg.payload &&
|
item.payload === msg.payload &&
|
||||||
item.timestamp === msg.timestamp &&
|
item.timestamp === msg.timestamp &&
|
||||||
item.contentTopic === msg.contentTopic
|
item.content_topic === msg.content_topic
|
||||||
);
|
);
|
||||||
return !found;
|
return !found;
|
||||||
});
|
});
|
||||||
@ -277,7 +285,7 @@ function App() {
|
|||||||
const decodeMsg = (index: number, msg: Message) => {
|
const decodeMsg = (index: number, msg: Message) => {
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
msg.contentTopic !==
|
msg.content_topic !==
|
||||||
`${COMMUNITY_CONTENT_TOPIC_PREFIX}/${community?.contentTopic}`
|
`${COMMUNITY_CONTENT_TOPIC_PREFIX}/${community?.contentTopic}`
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user