hey-pharmacist-ecommerce 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ import { Button } from '@/components/ui/Button';
21
21
  import { useAuth } from '@/providers/AuthProvider';
22
22
  import { toast } from 'sonner';
23
23
  import { CreateUserDtoCustomerTypeEnum, CreateUserDtoRoleEnum } from '@/lib/Apis/models';
24
+ import { useBasePath } from '@/providers/BasePathProvider';
24
25
 
25
26
  const registerSchema = z
26
27
  .object({
@@ -47,6 +48,7 @@ const BENEFITS = [
47
48
  export function RegisterScreen() {
48
49
  const router = useRouter();
49
50
  const { register: registerUser } = useAuth();
51
+ const { buildPath } = useBasePath();
50
52
  const [showPassword, setShowPassword] = useState(false);
51
53
  const [showConfirmPassword, setShowConfirmPassword] = useState(false);
52
54
  const [isSubmitting, setIsSubmitting] = useState(false);
@@ -70,7 +72,7 @@ export function RegisterScreen() {
70
72
  role: CreateUserDtoRoleEnum.User,
71
73
  });
72
74
  toast.success('Account created successfully!');
73
- router.push('/');
75
+ router.push(buildPath('/'));
74
76
  } catch (error: any) {
75
77
  toast.error(error.response?.data?.message || 'Failed to create account');
76
78
  } finally {
@@ -65,7 +65,7 @@ export function ShopScreen({ initialFilters = {}, categoryName }: ShopScreenProp
65
65
  e.preventDefault();
66
66
  if (searchQuery.trim()) {
67
67
  setIsSearching(true);
68
- router.push(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
68
+ router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
69
69
  }
70
70
  };
71
71
 
@@ -79,7 +79,7 @@ export function ShopScreen({ initialFilters = {}, categoryName }: ShopScreenProp
79
79
  if (e.key === 'Enter' && searchQuery.trim()) {
80
80
  e.preventDefault();
81
81
  setIsSearching(true);
82
- router.push(`/search?q=${encodeURIComponent(searchQuery.trim())}`);
82
+ router.push(buildPath(`/search?q=${encodeURIComponent(searchQuery.trim())}`));
83
83
  }
84
84
  };
85
85
 
@@ -183,7 +183,7 @@ export default function WishlistScreen() {
183
183
  <p className="mt-3 text-slate-500">
184
184
  Create your curated shelf of products and we&apos;ll keep them ready whenever you return.
185
185
  </p>
186
- <Button className="mt-6" onClick={() => router.push('/login')}>
186
+ <Button className="mt-6" onClick={() => router.push(buildPath('/login'))}>
187
187
  Sign In
188
188
  </Button>
189
189
  </div>
@@ -287,8 +287,8 @@ export default function WishlistScreen() {
287
287
  Bookmark pharmacy essentials, supplements, or skincare picks and we&apos;ll keep them safe until you&apos;re ready to checkout.
288
288
  </p>
289
289
  <div className="mt-8 flex flex-wrap justify-center gap-3">
290
- <Button onClick={() => router.push('/shop')}>Discover products</Button>
291
- <Button variant="outline" onClick={() => router.push('/categories')}>
290
+ <Button onClick={() => router.push(buildPath('/shop'))}>Discover products</Button>
291
+ <Button variant="outline" onClick={() => router.push(buildPath('/categories'))}>
292
292
  Browse categories
293
293
  </Button>
294
294
  </div>
@@ -381,7 +381,7 @@ export default function WishlistScreen() {
381
381
  <div className="flex flex-wrap gap-2">
382
382
  <Button
383
383
  size="sm"
384
- onClick={() => router.push(`/products/${product.id}`)}
384
+ onClick={() => router.push(buildPath(`/products/${product.id}`))}
385
385
  >
386
386
  View details
387
387
  </Button>