@autobusal/order-confirm 0.0.1 → 0.0.3

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.
Files changed (2) hide show
  1. package/OrderConfirm.tsx +8 -9
  2. package/package.json +1 -1
package/OrderConfirm.tsx CHANGED
@@ -4,10 +4,10 @@ import { useSearchParams, useParams, useNavigate } from 'react-router-dom';
4
4
  import { AiOutlineCheck } from 'react-icons/ai';
5
5
  import { BiErrorAlt } from 'react-icons/bi';
6
6
  import { IoReturnUpBackOutline } from 'react-icons/io5';
7
- // import { useAuthContext } from '../../../context/Auth';
8
7
  import { Meta, Button } from '@autobusal/common';
9
8
  import Reason from './Reason';
10
9
  import { Title, Actions } from './styles';
10
+ import { useUserStore } from '@autobusal/providers/stores/user';
11
11
 
12
12
  interface Props {
13
13
  t: TFunction<'common'>
@@ -16,14 +16,13 @@ interface Props {
16
16
  const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
17
17
  const [ searchParams ] = useSearchParams();
18
18
 
19
- const { type, order_id } = useParams();
19
+ const { type, hash } = useParams();
20
20
 
21
21
  const navigate = useNavigate();
22
22
 
23
23
  const message = String(searchParams.get('msg') ?? '');
24
24
 
25
- // @todo: sa mearga asta cu userul
26
- // const { user } = useAuthContext();
25
+ const { data: UserData } = useUserStore();
27
26
 
28
27
  const isAllowed = ['reserved', 'cancelled', 'purchased'].includes(
29
28
  String(type)
@@ -40,13 +39,13 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
40
39
  }
41
40
 
42
41
  const onManage = (): void => {
43
- navigate(`/viewtrip/${ order_id }`);
42
+ navigate(`/viewtrip/${ hash }`);
44
43
  };
45
44
 
46
45
  const onBack = (): void => {
47
- // const backUrl = user ? '/account' : '/';
48
-
49
- navigate('/');
46
+ navigate(
47
+ UserData ? '/account' : '/'
48
+ );
50
49
  };
51
50
 
52
51
  return (
@@ -57,7 +56,7 @@ const OrderConfirm = ({ t }: Props): (JSX.Element | null) => {
57
56
  </Title>
58
57
 
59
58
  <div className="box" dangerouslySetInnerHTML={{
60
- __html: t(`order_confirm.content.${ type}`, { order: `<strong>${ order_id }</strong>` })
59
+ __html: t(`order_confirm.content.${ type}`, { order: `<strong>${ hash }</strong>` })
61
60
  }} />
62
61
 
63
62
  <>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/order-confirm",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "index.ts"
6
6
  }