feat: module graphql client

This commit is contained in:
DIYgod
2023-05-19 23:28:48 +01:00
parent fe4ed39021
commit c0f85930d5
4 changed files with 8 additions and 21 deletions
-1
View File
@@ -178,7 +178,6 @@ export const HomeFeed: React.FC<{
}> = ({ noteIds, type }) => {
const { t } = useTranslation("common")
const searchParams = useSearchParams()
const router = useRouter()
const currentCharacterId = useAccountState(
(s) => s.computed.account?.characterId,
+1 -14
View File
@@ -1,10 +1,10 @@
import dayjs from "dayjs"
import { indexer } from "@crossbell/indexer"
import { cacheExchange, createClient, fetchExchange } from "@urql/core"
import { expandCrossbellNote } from "~/lib/expand-unit"
import { ExpandedNote } from "~/lib/types"
import { client } from "~/queries/graphql"
import filter from "../../data/filter.json"
@@ -118,10 +118,6 @@ export async function getFeed({
count: 0,
}
}
const client = createClient({
url: "https://indexer.crossbell.io/v1/graphql",
exchanges: [cacheExchange, fetchExchange],
})
const orString = noteIds
.map(
@@ -181,11 +177,6 @@ export async function getFeed({
}
}
case "hottest": {
const client = createClient({
url: "https://indexer.crossbell.io/v1/graphql",
exchanges: [cacheExchange, fetchExchange],
})
let time
if (daysInterval) {
time = dayjs().subtract(daysInterval, "day").toISOString()
@@ -330,10 +321,6 @@ export async function getFeed({
}
export const getShowcase = async () => {
const client = createClient({
url: "https://indexer.crossbell.io/v1/graphql",
exchanges: [cacheExchange, fetchExchange],
})
const oneMonthAgo = dayjs().subtract(10, "day").toISOString()
const listResponse = await client
+1 -6
View File
@@ -4,10 +4,10 @@ import type { Address } from "viem"
import type { useContract } from "@crossbell/contract"
import { indexer } from "@crossbell/indexer"
import { cacheExchange, createClient, fetchExchange } from "@urql/core"
import { expandCrossbellCharacter } from "~/lib/expand-unit"
import { SiteNavigationItem } from "~/lib/types"
import { client } from "~/queries/graphql"
type Contract = ReturnType<typeof useContract>
@@ -32,11 +32,6 @@ export const getSubscriptionsFromList = async (
list: number[],
fromCharacterId: number,
) => {
const client = createClient({
url: "https://indexer.crossbell.io/v1/graphql",
exchanges: [cacheExchange, fetchExchange],
})
const response = await client
.query(
`
+6
View File
@@ -0,0 +1,6 @@
import { cacheExchange, createClient, fetchExchange } from "@urql/core"
export const client = createClient({
url: "https://indexer.crossbell.io/v1/graphql",
exchanges: [cacheExchange, fetchExchange],
})