diff --git a/src/App.jsx b/src/App.jsx
index 65d7a33..899b0a6 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -2,7 +2,7 @@ import { useEffect, useState, Suspense, lazy } from 'react';
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
-import { auth , getUserSubscription } from './service/firebase';
+import { auth, getUserSubscription } from './service/firebase';
import styles from './App.module.scss';
import Loading from './pages/Loading/loading';
import Pricing from './pages/Payement/Pricing/Pricing';
@@ -22,6 +22,7 @@ const App = () => {
const [loading, setLoading] = useState(true);
const [showLoading, setShowLoading] = useState(false);
const [subscription, setSubscription] = useState(0);
+ const [loadingSubscription, setLoadingSubscription] = useState(true);
useEffect(() => {
const timeoutId = setTimeout(() => setShowLoading(true), 6000);
@@ -48,17 +49,23 @@ const App = () => {
if (user) {
const fetchSubscription = async () => {
try {
+ setLoadingSubscription(true);
const userSubscription = await getUserSubscription(user.uid);
+ console.log('User Subscription:', userSubscription);
setSubscription(userSubscription || 0);
} catch (error) {
console.error('Error fetching subscription:', error);
+ } finally {
+ setLoadingSubscription(false);
}
};
fetchSubscription();
+ } else {
+ setLoadingSubscription(false);
}
}, [user]);
-
- if (loading && showLoading) {
+
+ if (loading || loadingSubscription) {
return ;
}
diff --git a/src/service/api.tsx b/src/service/api.tsx
index 0786875..2464f96 100644
--- a/src/service/api.tsx
+++ b/src/service/api.tsx
@@ -94,7 +94,7 @@ class serviiApi {
public static async fetchModpacks(): Promise {
try {
- const response = await fetch(`${apiUrl}/modpacks`, {
+ const response = await fetch(`https://www.servii.fr/api/modpacks/image/a-metadata.txt`, {
method: 'GET',
});
const json = await response.json();