Fakultas Ilmu Komputer UI

schema.ts 596 Bytes
Newer Older
Wulan Mantiri's avatar
Wulan Mantiri committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as ROUTES from 'constants/routes';
import {
  publicNavigation,
  privateNavigation,
  unpaidClientNavigation,
} from 'constants/navigation';

export const getNavigation = (
  isAuthenticated: boolean,
  isUnpaidClient: boolean,
) => {
  if (isAuthenticated) {
    return isUnpaidClient
      ? {
          initialRoute: ROUTES.checkout,
          navigation: unpaidClientNavigation,
        }
      : {
          initialRoute: ROUTES.profile,
          navigation: privateNavigation,
        };
  }
  return {
    initialRoute: ROUTES.initial,
    navigation: publicNavigation,
  };
};