Skip to content

Commit

Permalink
Add denyTeam function to TeamsActions component
Browse files Browse the repository at this point in the history
  • Loading branch information
mansithaeashwara committed Jan 28, 2024
1 parent 116d60f commit 84bbe5e
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,36 @@ import styles from "./TeamsActions.module.scss";
import AlertModal from "../../Modal/AlertModal";
import { FaCheck } from "react-icons/fa6";
import { MyTeam } from "../../../types";
import { renewAccessToken } from "../../../services/authService";
import { BASE_URL } from "../../../config/config";

const TeamActions: React.FC<MyTeam> = ({
// team_id,
team_id,
team_name,
verification,
}) => {
const denyTeam = async () => {
// renew access Token
console.log("I am here");
renewAccessToken();

const token = localStorage.getItem("accessToken");

const response = await fetch(
`${BASE_URL}/player/accept-invite/${team_id}/${0}`,
{
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
}
);
// const responseData = await response.json();
console.log("Hello", response);
// return response;
};

return (
<div className={styles.actions}>
<AlertModal
Expand Down Expand Up @@ -51,6 +75,7 @@ const TeamActions: React.FC<MyTeam> = ({
bgColor="rgba(255,255,255,0)"
Icon={FaTrash}
iconSizeEm={1.2}
disabled={verification === "verified"}
>
Deny
</Btn>
Expand All @@ -74,6 +99,7 @@ const TeamActions: React.FC<MyTeam> = ({
buttonStyle="secondary"
Icon={FaTrash}
iconSizeEm={1}
onClick={() => denyTeam()}
>
Deny
</Btn>
Expand Down

0 comments on commit 84bbe5e

Please sign in to comment.