diff --git a/src/pages/CreateServer/CreateServer.jsx b/src/pages/CreateServer/CreateServer.jsx index ecbf540..98b5e54 100644 --- a/src/pages/CreateServer/CreateServer.jsx +++ b/src/pages/CreateServer/CreateServer.jsx @@ -2,60 +2,75 @@ import styles from './CreateServer.module.scss'; import PropTypes from "prop-types"; import Navbar from '../../components/navbar/Navbar'; import { useNavigate } from 'react-router-dom'; -import bedrockimg from '../../assets/bedrock.png'; +import bedrockimg from '../../assets/bedrock.png'; import modedimg from '../../assets/moded.png'; -import javaimg from '../../assets/java.png' +import javaimg from '../../assets/java.png'; +import { getUserSubscription } from "../../service/firebase"; +import { useState, useEffect } from 'react'; const CreateServer = ({ user }) => { const navigate = useNavigate(); + const [subscription, setSubscription] = useState(0); + + useEffect(() => { + const fetchSubscription = async () => { + try { + const userSubscription = await getUserSubscription(user.uid); + setSubscription(userSubscription || 0); + } catch (error) { + console.error('Error fetching subscription:', error); + } + }; + + fetchSubscription(); + }, [user.uid]); - return (