feat: module graphql client
This commit is contained in:
@@ -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,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
|
||||
|
||||
@@ -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(
|
||||
`
|
||||
|
||||
@@ -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],
|
||||
})
|
||||
Reference in New Issue
Block a user