mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
fix road
This commit is contained in:
parent
9925a54445
commit
67f1a50fa5
@ -22,6 +22,7 @@ const App = () => {
|
|||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [showLoading, setShowLoading] = useState(false);
|
const [showLoading, setShowLoading] = useState(false);
|
||||||
const [subscription, setSubscription] = useState(0);
|
const [subscription, setSubscription] = useState(0);
|
||||||
|
const [loadingSubscription, setLoadingSubscription] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timeoutId = setTimeout(() => setShowLoading(true), 6000);
|
const timeoutId = setTimeout(() => setShowLoading(true), 6000);
|
||||||
@ -48,17 +49,23 @@ const App = () => {
|
|||||||
if (user) {
|
if (user) {
|
||||||
const fetchSubscription = async () => {
|
const fetchSubscription = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoadingSubscription(true);
|
||||||
const userSubscription = await getUserSubscription(user.uid);
|
const userSubscription = await getUserSubscription(user.uid);
|
||||||
|
console.log('User Subscription:', userSubscription);
|
||||||
setSubscription(userSubscription || 0);
|
setSubscription(userSubscription || 0);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching subscription:', error);
|
console.error('Error fetching subscription:', error);
|
||||||
|
} finally {
|
||||||
|
setLoadingSubscription(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchSubscription();
|
fetchSubscription();
|
||||||
|
} else {
|
||||||
|
setLoadingSubscription(false);
|
||||||
}
|
}
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
if (loading && showLoading) {
|
if (loading || loadingSubscription) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class serviiApi {
|
|||||||
|
|
||||||
public static async fetchModpacks(): Promise<ApiResponse> {
|
public static async fetchModpacks(): Promise<ApiResponse> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${apiUrl}/modpacks`, {
|
const response = await fetch(`https://www.servii.fr/api/modpacks/image/a-metadata.txt`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
});
|
});
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
Loading…
Reference in New Issue
Block a user