Skip to content

Commit

Permalink
update document
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-teddy committed Jan 31, 2024
1 parent d85ac2d commit c66fe45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Folder structure:
- **`global.d.ts`**: Contains TypeScript declarations for third-party modules and global objects.
- **`state.ts`**: State management, containing Recoil's atoms and selectors (https://recoiljs.org/docs/introduction/getting-started#atom).

- **`mock`**: Example data as \*.json files.

- **`app-config.json`**: Global configuration for your Mini App (https://mini.zalo.me/docs/framework/getting-started/app-config).

The other files (such as `tailwind.config.js`, `vite.config.ts`, `tsconfig.json`, `postcss.config.js`) are configurations for libraries used in your application. Visit the library's documentation to learn how to use them.
Expand Down Expand Up @@ -119,6 +121,8 @@ You can customizations primary colors and currency displays using [Zalo Mini App

<img src="./docs/products-fetching.webp" alt="Products fetching" width="250" align="right">

For a simple MVP, you can put in your store products and categories as simply as making changes to `mock/*.json` files. However, a typical application would likely need to fetch data over REST API.

To make an HTTP GET request to your server and fetch the product list, update the `productsState` selector in src/state.ts to use `fetch`.

If the returned JSON structure is different from the template, you would need to map your product object to the corresponding `Product` interface. For example:
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"react-router-dom": "^6.8.2",
"recoil": "^0.7.7",
"swiper": "^9.1.0",
"zmp-sdk": "^2.35.2",
"zmp-sdk": "^2.35.3",
"zmp-ui": "^1.6.0-rc.6"
},
"devDependencies": {
Expand Down

0 comments on commit c66fe45

Please sign in to comment.