Updated to use new api and new weapon display
This commit is contained in:
@@ -7,15 +7,15 @@ import { useNotification } from "~/hooks/notification";
|
||||
export function Inventory({ side }: { side: "T" | "CT" }) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [agent, setAgent] = useState({});
|
||||
const [gloves, setGloves] = useState({ name: "", color: "", paint_index: 0 });
|
||||
const [knife, setKnife] = useState({ name: "", color: "", paint_index: 0 });
|
||||
const [gloves, setGloves] = useState({ name: "", color: "", display: "", paint_index: 0, float: 0.0, pattern: 0 });
|
||||
const [knife, setKnife] = useState({ name: "", color: "", display: "", paint_index: 0, float: 0.0, pattern: 0 });
|
||||
const [weapons, setWeapons] = useState([]);
|
||||
const { notify } = useNotification();
|
||||
|
||||
useEffect(() => {
|
||||
const fetch_weapons = async () => {
|
||||
let response = await fetch(
|
||||
`${import.meta.env.VITE_BASE_API_URL}/knife?team=${side}`,
|
||||
`${import.meta.env.VITE_BASE_API_URL}/skin?team=${side}&category=Knives`,
|
||||
{ credentials: "include" },
|
||||
)
|
||||
.then((r) => r.json())
|
||||
@@ -31,10 +31,10 @@ export function Inventory({ side }: { side: "T" | "CT" }) {
|
||||
);
|
||||
});
|
||||
|
||||
setKnife(response);
|
||||
setKnife(response[0]);
|
||||
|
||||
response = await fetch(
|
||||
`${import.meta.env.VITE_BASE_API_URL}/gloves?team=${side}`,
|
||||
`${import.meta.env.VITE_BASE_API_URL}/skin?team=${side}&category=Gloves`,
|
||||
{ credentials: "include" },
|
||||
)
|
||||
.then((r) => r.json())
|
||||
@@ -50,7 +50,7 @@ export function Inventory({ side }: { side: "T" | "CT" }) {
|
||||
);
|
||||
});
|
||||
|
||||
setGloves(response)
|
||||
setGloves(response[0])
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
@@ -100,11 +100,17 @@ export function Inventory({ side }: { side: "T" | "CT" }) {
|
||||
weapon_id={knife["name"]}
|
||||
color={knife["color"]}
|
||||
paint_index={knife["paint_index"]}
|
||||
display={knife["display"]}
|
||||
float={knife["float"]}
|
||||
pattern={knife["pattern"]}
|
||||
></Weapon>
|
||||
<Weapon
|
||||
weapon_id={gloves["name"]}
|
||||
color={gloves["color"]}
|
||||
paint_index={gloves["paint_index"]}
|
||||
display={gloves["display"]}
|
||||
float={gloves["float"]}
|
||||
pattern={gloves["pattern"]}
|
||||
></Weapon>
|
||||
<Weapon
|
||||
weapon_id={"agent-4730"}
|
||||
|
||||
Reference in New Issue
Block a user