Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit d6ee6a2

Browse files
author
Ildar Timerbaev
committed
Added promoted query
1 parent 44fe872 commit d6ee6a2

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ecency/sdk",
33
"private": false,
4-
"version": "1.0.44",
4+
"version": "1.0.45",
55
"type": "module",
66
"license": "MIT",
77
"main": "./dist/ecency-sdk.umd.js",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { CONFIG } from "@/modules/core";
2+
import { queryOptions } from "@tanstack/react-query";
3+
4+
// TODO: replace any with Entry
5+
export function getPromotedPostsQuery<T extends any>(
6+
type: "feed" | "waves" = "feed"
7+
) {
8+
return queryOptions({
9+
queryKey: ["posts", "promoted", type],
10+
queryFn: async () => {
11+
const url = new URL(
12+
CONFIG.privateApiHost + "/private-api/promoted-entries"
13+
);
14+
if (type === "waves") {
15+
url.searchParams.append("short_content", "1");
16+
}
17+
18+
const response = await fetch(url.toString(), {
19+
method: "GET",
20+
headers: {
21+
"Content-Type": "application/json",
22+
},
23+
});
24+
const data = await response.json();
25+
return data as T[];
26+
},
27+
});
28+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./get-trending-tags-query-options";
22
export * from "./get-fragments-query-options";
3+
export * from "./get-promoted-posts-query-options";

packages/wallets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ecency/wallets",
33
"private": false,
4-
"version": "1.2.18",
4+
"version": "1.2.19",
55
"type": "module",
66
"license": "MIT",
77
"main": "./dist/ecency-sdk.umd.js",

0 commit comments

Comments
 (0)