Guest User

Untitled

a guest
Mar 13th, 2021
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. import React, { useEffect, useState } from 'react';
  2. import { Button } from '@material-ui/core/Button';
  3.  
  4. import { Tab, Row, Col, ListGroup } from 'react-bootstrap';
  5.  
  6.  
  7. import './ChatPage.css';
  8.  
  9. export const ChatPage = () => {
  10. const [isLoading, setLoading] = useState(true);
  11. const [welcomeName, setWelcomeName] = useState("");
  12.  
  13. useEffect(() => {
  14. if (isLoading) {
  15. fetch('/ChatPage/Ping',
  16. {
  17. method: 'POST',
  18. headers: { "Accept": "application/json", "Content-Type": "application/json" },
  19. body: JSON.stringify({
  20. id: 3,
  21. username: "dsds",
  22. fp: "ewq",
  23. sextype: "qwe"
  24. })
  25. }).then(response => {
  26. if (response.ok == true) {
  27. setLoading(false);
  28. setWelcomeName("User");
  29. }
  30. });
  31. }
  32. })
  33.  
  34.  
  35. if (isLoading) {
  36. return (
  37. <div>
  38. <h1>Loading...</h1>
  39. </div>
  40. );
  41. } else {
  42. return (
  43.  
  44. <div className="container">
  45.  
  46. <div className="columnusers" id="cleft">
  47. <ul id="users">
  48. <Tab.Container id="list-group-tabs-example" defaultActiveKey="#link1">
  49. <Row>
  50. <Col sm={4}>
  51. <ListGroup>
  52. <ListGroup.Item action href="#link1">
  53. Link 1
  54. </ListGroup.Item>
  55. <ListGroup.Item action href="#link2">
  56. Link 2
  57. </ListGroup.Item>
  58. </ListGroup>
  59. </Col>
  60. <Col sm={8}>
  61. <Tab.Content>
  62. <Tab.Pane eventKey="#link1">
  63. <h1>Hello {welcomeName}</h1>
  64. </Tab.Pane>
  65. <Tab.Pane eventKey="#link2">
  66. <h2>Hello {welcomeName}</h2>
  67. </Tab.Pane>
  68. </Tab.Content>
  69. </Col>
  70. </Row>
  71. </Tab.Container>
  72. </ul>
  73. </div>
  74. <div className="columntext" id="cright">
  75. <ul id="messages">
  76.  
  77. </ul>
  78. </div>
  79.  
  80. </div>
  81.  
  82. );
  83. }
  84. }
  85.  
  86.  
Advertisement
Add Comment
Please, Sign In to add comment