blob: 73950a2541182c7adee0d23d5254377ac8c0252b [file] [log] [blame]
idillon531b6f22022-09-16 14:02:00 -04001import List from "@mui/material/List";
2import authManager from "../AuthManager";
3import React, { useState, useEffect } from "react";
4import { useAppDispatch, useAppSelector } from "../../redux/hooks";
5
Larbi Gharibe9af9732021-03-31 15:08:01 +01006
Adrien Béraud86986032021-04-25 12:04:53 -04007export default function ContactList() {
idillon531b6f22022-09-16 14:02:00 -04008 const { accountId } = useAppSelector((state) => state.app);
9 const dispatch = useAppDispatch();
Adrien Béraud995e8022021-04-08 13:46:51 -040010
idillon531b6f22022-09-16 14:02:00 -040011 const [contacts, setContacts] = useState([]);
12
13 useEffect(() => {
14 const controller = new AbortController();
15 authManager
16 .fetch(`/api/accounts/${accountId}/contacts/`, {
17 method: "GET",
18 header: { "Content-Type": "application/json" },
19 // signal: controller.signal,
20 })
21 .then((res) => {
22 res.json();
23 })
24 .then((result) => {
25 console.log(result);
26 });
27 return () => controller.abort();
28 }, []);
29
30 return (
31 <div className="rooms-list">
32 <List></List>
33 </div>
34 );
Larbi Gharibe9af9732021-03-31 15:08:01 +010035}