-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): - add wishlist lazyload and totalItems shared field
- Loading branch information
1 parent
5855c30
commit 4c2dbcc
Showing
19 changed files
with
150 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ApolloQueryResult } from '@apollo/client/core'; | ||
import { CustomQuery } from '@vue-storefront/core'; | ||
|
||
import { | ||
WishlistQuery, | ||
} from '../../types/GraphQL'; | ||
import query from './wishlistItemsCount'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ( | ||
context: Context, | ||
customQuery: CustomQuery = { wishlistItemsCount: 'wishlistItemsCount' }, | ||
): Promise<ApolloQueryResult<WishlistQuery>> => { | ||
const { wishlistItemsCount } = context.extendQuery(customQuery, { | ||
wishlistItemsCount: { | ||
query, | ||
}, | ||
}); | ||
try { | ||
return await context.client | ||
.query<WishlistQuery>({ | ||
query: wishlistItemsCount.query, | ||
}); | ||
} catch (error) { | ||
throw error.graphQLErrors?.[0].message || error.networkError?.result || error; | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/api-client/src/api/wishlistItemsCount/wishlistItemsCount.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
query wishlist { | ||
customer { | ||
wishlists { | ||
items_count | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.