Fakultas Ilmu Komputer UI

index.tsx 681 Bytes
Newer Older
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 React, { FC } from 'react';

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

const ClientRecommendation: FC = () => {
  const { isLoading, data: recommendation } = useApi(
    retrieveDietRecommendationApi,
  );

  if (isLoading) {
    return <Loader />;
  }
  return (
    <ReadOnlyDietRecommendation
      data={
        recommendation && recommendation.length > 0
          ? recommendation[0]
          : undefined
      }
    />
  );
};

export default ClientRecommendation;