implement adding new gang, show only homies for selected gang
This commit is contained in:
@@ -10,10 +10,12 @@ import YesNoModal from "../common/YesNoModal";
|
||||
const Homies = (props) => {
|
||||
const [homies, setHomies] = useState([]);
|
||||
|
||||
const gang = props.gang;
|
||||
|
||||
useEffect(() => {
|
||||
(async() => {
|
||||
try {
|
||||
const response = await axios.get(`/api/homies`);
|
||||
const response = await axios.get(`/api/gangs/${gang.id}/homies`);
|
||||
if (response.status === 200 && response.data){
|
||||
setHomies(response.data);
|
||||
}else{
|
||||
@@ -27,7 +29,7 @@ const Homies = (props) => {
|
||||
|
||||
const deleteHomie = async (id) => {
|
||||
try {
|
||||
const response = await axios.delete(`/api/homies/${id}`);
|
||||
const response = await axios.delete(`/api/gangs/${gang.id}/homies/${id}`);
|
||||
if (response.status === 200 && response.data){
|
||||
setHomies(response.data);
|
||||
M.toast({ html: "See y'a on the other side Homie" });
|
||||
|
||||
Reference in New Issue
Block a user