11import Layout from '@theme/Layout' ;
22import React , { useEffect , useState } from 'react' ;
3+ import { API_CONFIG , getEndpoint } from './config' ;
34import styles from './styles.module.css' ;
45
56export default function ClanProfile ( ) {
@@ -16,7 +17,7 @@ export default function ClanProfile() {
1617 useEffect ( ( ) => {
1718 const fetchWarData = async ( ) => {
1819 try {
19- const response = await fetch ( 'https://coc-apis.behitek.com/clans/%232G9YRCRV2/currentwar' ) ;
20+ const response = await fetch ( getEndpoint ( API_CONFIG . endpoints . currentWar ) ) ;
2021 const warApiData = await response . json ( ) ;
2122 setWarData ( warApiData ) ;
2223 } catch ( err ) {
@@ -30,7 +31,7 @@ export default function ClanProfile() {
3031 useEffect ( ( ) => {
3132 const fetchClanData = async ( ) => {
3233 try {
33- const response = await fetch ( 'https://coc-apis.behitek.com/clans/%232G9YRCRV2' ) ;
34+ const response = await fetch ( getEndpoint ( API_CONFIG . endpoints . clanInfo ) ) ;
3435 const data = await response . json ( ) ;
3536 setClanData ( data ) ;
3637 setIsLoading ( false ) ;
@@ -217,7 +218,7 @@ export default function ClanProfile() {
217218 const button = event . currentTarget ;
218219 button . classList . add ( styles . processing ) ;
219220 try {
220- const response = await fetch ( 'https://coc-apis.behitek.com/clans/%232G9YRCRV2/currentwar' ) ;
221+ const response = await fetch ( getEndpoint ( API_CONFIG . endpoints . currentWar ) ) ;
221222 const warApiData = await response . json ( ) ;
222223 setWarData ( warApiData ) ;
223224 button . classList . remove ( styles . processing ) ;
0 commit comments