Fakultas Ilmu Komputer UI

index.tsx 803 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
import React, { FC } from 'react';
import { useRoute } from '@react-navigation/native';

import { Loader } from 'components/core';
import ReadOnlyDietRecommendation from 'scenes/questionnaire/ReadOnlyDietRecommendation';
import { useApi } from 'hooks';
import { retrieveDietRecommendationByIdApi } from 'services/dietRecommendation';
import { DietRecommendationResponse } from 'services/dietRecommendation/models';

10
const ClientDietRecommendationForAdmin: FC = () => {
11
12
13
14
15
16
17
18
19
20
21
22
23
  const route = useRoute();
  const { id } = route.params as DietRecommendationResponse;

  const { isLoading, data } = useApi(() =>
    retrieveDietRecommendationByIdApi(id),
  );

  if (isLoading) {
    return <Loader />;
  }
  return <ReadOnlyDietRecommendation data={data} />;
};

24
export default ClientDietRecommendationForAdmin;