-
Notifications
You must be signed in to change notification settings - Fork 1
/
UserDetails.js
43 lines (37 loc) · 1.09 KB
/
UserDetails.js
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import { Header, Footer, H2 } from '../components';
import styled from 'styled-components';
import { Link, useParams } from 'react-router-dom';
import {
useGetUserQuery,
} from '../services/UserServices';
const UserDetails = () => {
const { userId } = useParams();
const { data, isFetching } = useGetUserQuery(userId);
return (
<>
<ScrollView>
<Header />
<Container>
<H2>User Details</H2>
<Link to="/users">Go Back</Link>
{isFetching ? <p>Loading...</p> :
<div>
<p><b>Name:</b> {data?.data?.name}</p>
<p><b>Email:</b> {data?.data?.email}</p>
</div>
}
</Container>
</ScrollView>
<Footer />
</>
);
};
export default UserDetails;
const ScrollView = styled.div`
min-height: calc(100vh - 80px);
`;
const Container = styled.div`
text-align: center;
padding-top: 50px;
`;