Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Refactor: clean gql pt1 asset (#217)
Browse files Browse the repository at this point in the history
* refactor: update query name

* refactor: update query name

* refactor: update generated client api for asset
  • Loading branch information
airslice committed May 9, 2022
1 parent 0ac0c2d commit b88a8c3
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 143 deletions.
8 changes: 4 additions & 4 deletions src/components/organisms/Common/AssetContainer/hooks.ts
Expand Up @@ -3,16 +3,16 @@ import { useCallback, useState, useEffect } from "react";
import { useIntl } from "react-intl";

import {
AssetsQuery,
useAssetsQuery,
GetAssetsQuery,
useGetAssetsQuery,
useCreateAssetMutation,
useRemoveAssetMutation,
Maybe,
AssetSortType as GQLSortType,
} from "@reearth/gql";
import { useNotification } from "@reearth/state";

export type AssetNodes = NonNullable<AssetsQuery["assets"]["nodes"][number]>[];
export type AssetNodes = NonNullable<GetAssetsQuery["assets"]["nodes"][number]>[];

export type AssetSortType = "date" | "name" | "size";

Expand Down Expand Up @@ -59,7 +59,7 @@ export default (teamId?: string, initialAssetUrl?: string | null, allowDeletion?
const [searchTerm, setSearchTerm] = useState<string>();
const gqlCache = useApolloClient().cache;

const { data, refetch, loading, fetchMore, networkStatus } = useAssetsQuery({
const { data, refetch, loading, fetchMore, networkStatus } = useGetAssetsQuery({
variables: {
teamId: teamId ?? "",
pagination: pagination(sort),
Expand Down
274 changes: 137 additions & 137 deletions src/gql/graphql-client-api.tsx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/gql/queries/asset.ts
@@ -1,7 +1,7 @@
import { gql } from "@apollo/client";

export const ASSETS = gql`
query Assets($teamId: ID!, $sort: AssetSortType, $keyword: String, $pagination: Pagination) {
export const GET_ASSETS = gql`
query GetAssets($teamId: ID!, $sort: AssetSortType, $keyword: String, $pagination: Pagination) {
assets(teamId: $teamId, keyword: $keyword, sort: $sort, pagination: $pagination) {
edges {
cursor
Expand Down

0 comments on commit b88a8c3

Please sign in to comment.