Skip to content

Commit

Permalink
feat: documents (SWF-286)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanilowicz authored and patzick committed Mar 16, 2023
1 parent 385f084 commit 240eae8
Show file tree
Hide file tree
Showing 237 changed files with 294 additions and 513 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-countries-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vue-demo-store": minor
---

Add documents to the order summary
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ There is an `errorInterceptor` (see [axios interceptors](https://axios-http.com/
When there is an error returend from a request you can expect at least the following fields: `message`, `code` and `errors` (containing an array with one or multiple `ShopwareError` objects). You can find the type definition at `packages/types/shopware-6-client/errors/ApiError.d.ts`.

### Structure

Let's say we want to use the `getCustomerRegisterEndpoint` which points to `/store-api/account/register`. These function is used inside the `customerService` by an async function called `register` and returning a promise with an Customer object. Further the `register` function is used inside a composable called `useUser()`. There is also a function called `register` that is wrapping the `register` function from the API client. When you now look at the `register.vue` page inside the vue-demo-store implementation, you will see, that the submit of the form is invoked.

__So the way is like this:__
**So the way is like this:**
API client Endpoint (TS) **>** API client Service (TS) **>** Composable (TS) **>** Vue

## Example (Vue page/template)

Look at this `invokeSubmit` function from `templates/vue-demo-store/pages/register.vue`

```js
<script setup lang="ts">
const { register } = useUser();
Expand Down Expand Up @@ -58,7 +60,8 @@ Look at this `invokeSubmit` function from `templates/vue-demo-store/pages/regist
//... content reduced
</script>
```
Before some request is sent the form get's validated and if it is valid, we will send the register request. The `await register(state);` part is coming from the composable `useUser()`, you see at the top of the script setup. So the request is surrounded by a try/catch/finally (see also [axios errors handling](https://axios-http.com/docs/handling_errors)) so it is possible to react if there is some error coming back from the request. If we got an error we will push a message to a composable called `useNotifications()` that will display a nice message to the user of the website.
Before some request is sent the form get's validated and if it is valid, we will send the register request. The `await register(state);` part is coming from the composable `useUser()`, you see at the top of the script setup. So the request is surrounded by a try/catch/finally (see also [axios errors handling](https://axios-http.com/docs/handling_errors)) so it is possible to react if there is some error coming back from the request. If we got an error we will push a message to a composable called `useNotifications()` that will display a nice message to the user of the website.
**API Client Reference**
<PageRef page="../../packages/api-client" title="API Client Reference" sub="Package reference with all services" />
<PageRef page="../../packages/api-client" title="API Client Reference" sub="Package reference with all services" />
2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/addCartItems.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# addCartItems

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/addProductReview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# addProductReview

<!-- PLACEHOLDER_DESCRIPTION -->


1 change: 0 additions & 1 deletion apps/docs/src/packages/api-client/addProductToCart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ category: api-client
# addProductToCart

<!-- PLACEHOLDER_DESCRIPTION -->

2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/addPromotionCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# addPromotionCode

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/addWishlistProduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# addWishlistProduct

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/cancelOrder.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# cancelOrder

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/changeCartItemQuantity.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# changeCartItemQuantity

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/changeOrderPaymentMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# changeOrderPaymentMethod

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/clearCart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# clearCart

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# config

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# confirmAccountRegistration

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/confirmPasswordReset.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# confirmPasswordReset

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/createCustomerAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# createCustomerAddress

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/createInstance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# createInstance

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/createOrder.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# createOrder

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/deleteCustomerAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# deleteCustomerAddress

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAddWishlistProductEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getAvailableCountries.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailableCountries

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getAvailableCurrencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailableCurrencies

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getAvailableLanguages.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailableLanguages

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailablePaymentMethods

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getAvailableSalutations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailableSalutations

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getAvailableShippingMethods

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCancelOrderEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCancelOrderEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCart

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCategories.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCategories

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCategory

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCategoryDetailsEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCategoryEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCategoryEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCategoryProducts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCategoryProducts

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getChangeOrderPaymentMethodEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCheckoutCartEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCheckoutCartEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCheckoutCartLineItemEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCheckoutOrderEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCheckoutOrderEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCmsPage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCmsPage

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getConfirmPasswordResetEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getContactFormEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContactFormEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextCountryEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextCurrencyEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getContextEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextLanguageEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextPaymentMethodEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextSalutationEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getContextShippingMethodEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomer

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerAccountConfirmEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerAddAddressEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerAddress

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerAddressEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerAddresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerAddresses

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerDefaultBillingAddressEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerDefaultShippingAddressEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerDetailsUpdateEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerLoginEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerLoginEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerLogoutEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerOrderEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerOrderEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


2 changes: 0 additions & 2 deletions apps/docs/src/packages/api-client/getCustomerOrders.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerOrders

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerRegisterEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ category: api-client
# getCustomerResetPasswordEndpoint

<!-- PLACEHOLDER_DESCRIPTION -->


Loading

0 comments on commit 240eae8

Please sign in to comment.