Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3530 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3530 Rev 3661
Línea 1... Línea 1...
1
import React from 'react';
1
import React from 'react';
2
import { Avatar, Box, Typography } from '@mui/material';
2
import { Avatar, Box, Typography } from '@mui/material';
Línea 3... Línea 3...
3
 
3
 
-
 
4
import { useAlert, useApi } from '@shared/hooks';
-
 
5
import { getProfile } from '@microlearning/services';
4
import { useFetch } from '@shared/hooks';
6
 
5
import { Spinner } from '@shared/components';
7
import { Spinner } from '@shared/components';
Línea 6... Línea 8...
6
import { DetailTag } from '@microlearning/components';
8
import { DetailTag } from '@microlearning/components';
-
 
9
 
-
 
10
export function ProfilePage() {
7
 
11
  const { showError } = useAlert();
-
 
12
 
-
 
13
  const { data: profile, loading } = useApi(getProfile, {
-
 
14
    autoFetch: true,
-
 
15
    onError: (error) => {
-
 
16
      showError(error.message);
Línea 8... Línea 17...
8
export function ProfilePage() {
17
    }
Línea 9... Línea 18...
9
  const { data, loading } = useFetch('/microlearning/profile');
18
  });
10
 
19
 
11
  if (loading || !data) return <Spinner />;
20
  if (loading) return <Spinner />;
12
 
21
 
13
  return (
22
  return (
14
    <>
23
    <>
15
      <Box textAlign='center'>
24
      <Box textAlign='center'>
16
        <Avatar
25
        <Avatar
17
          src={data[0]?.image}
26
          src={profile[0]?.image}
18
          alt={data[0]?.name}
27
          alt={profile[0]?.name}
Línea 19... Línea 28...
19
          sx={{ width: 100, height: 100, margin: '0 auto' }}
28
          sx={{ width: 100, height: 100, margin: '0 auto' }}
20
        />
29
        />
21
        <Typography variant='h2'>{data[0]?.name}</Typography>
30
        <Typography variant='h2'>{profile[0]?.name}</Typography>
22
      </Box>
31
      </Box>
23
 
32
 
24
      <Box display='flex' flexDirection='column' gap={1} width='100%' mt={2}>
33
      <Box display='flex' flexDirection='column' gap={1} width='100%' mt={2}>
25
        {data[0]?.details?.map(({ uuid, label, value }) => (
34
        {profile[0]?.details?.map(({ uuid, label, value }) => (