This file contains hidden or 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
| export const API_CONFIG = { | |
| BASE_URL: import.meta.env.VITE_API_URL || 'http://localhost:8000/api', | |
| TIMEOUT: 10000, | |
| }; | |
| export const PRODUCT_STATUS = { | |
| ACTIVE: 'active', | |
| INACTIVE: 'inactive', | |
| OUT_OF_STOCK: 'out_of_stock' | |
| }; |
This file contains hidden or 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
| export const API_CONFIG = { | |
| BASE_URL: import.meta.env.VITE_API_URL || 'http://localhost:8000/api', | |
| TIMEOUT: 10000, | |
| }; | |
| export const PRODUCT_STATUS = { | |
| ACTIVE: 'active', | |
| INACTIVE: 'inactive', | |
| OUT_OF_STOCK: 'out_of_stock' | |
| }; |
This file contains hidden or 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
| export const validateProduct = (product) => { | |
| const errors = {}; | |
| if (!product.name || product.name.trim() === '') { | |
| errors.name = 'Product name is required'; | |
| } | |
| if (!product.price || product.price <= 0) { | |
| errors.price = 'Price must be greater than 0'; | |
| } |
This file contains hidden or 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
| export const Input = ({ | |
| label, | |
| type = 'text', | |
| value, | |
| onChange, | |
| placeholder, | |
| error, | |
| required = false, | |
| ...props | |
| }) => { |
This file contains hidden or 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
| import { useState, useEffect } from 'react'; | |
| import { productAPI } from '../services/api'; | |
| export const useProducts = () => { | |
| const [products, setProducts] = useState([]); | |
| const [loading, setLoading] = useState(false); | |
| const [error, setError] = useState(null); | |
| const fetchProducts = async () => { | |
| setLoading(true); |
This file contains hidden or 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
| const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/api'; | |
| const handleResponse = async (response) => { | |
| if (!response.ok) { | |
| const error = await response.json(); | |
| throw new Error(error.message || 'API request failed'); | |
| } | |
| return response.json(); | |
| }; |
This file contains hidden or 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
| <?php | |
| use App\Models\User; | |
| use Illuminate\Foundation\Testing\RefreshDatabase; | |
| use Illuminate\Foundation\Testing\WithFaker; | |
| use Illuminate\Support\Facades\Hash; | |
| use Tests\TestCase; | |
| class AuthenticationTest extends TestCase | |
| { |