Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // src/pages/cms/products/CMSProductsPage.tsx
- import { useProductsService } from '@/services/products';
- export function CMSProductsPage() {
- const { state, actions } = useProductsService();
- async function getProductsHandler() {
- actions.getProducts()
- }
- return (
- <div>
- <h1 className="title">CMS</h1>
- Pagina Prodotti
- <hr className="my-8"/>
- {state.pending && <div>loading...</div>}
- {state.error && <div>error!!!!</div>}
- <button className="btn primary" onClick={getProductsHandler}>GET</button>
- <pre>{JSON.stringify(state, null, 2)}</pre>
- </div>
- )
- }
- // =============================
- // services/products/index.ts
- export { useProductsService } from './useProductsService';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement