From 30bffad66088c624a64f84d289f9b39be7f9ca4c Mon Sep 17 00:00:00 2001 From: Marces <63728693+SPKChaosPhoenix@users.noreply.github.com> Date: Fri, 28 Feb 2025 21:17:26 +0100 Subject: [PATCH] ad --- frontend/src/pages/createCharacter.jsx | 2 +- frontend/src/pages/createItem.jsx | 2 +- frontend/src/pages/createNpc.jsx | 2 +- frontend/src/pages/gameMasterPage.jsx | 20 ++++++++++---------- frontend/src/pages/games.jsx | 8 ++++---- frontend/src/pages/joinGame.jsx | 2 +- frontend/src/pages/login.jsx | 2 +- frontend/src/pages/profile.jsx | 2 +- frontend/src/pages/register.jsx | 2 +- frontend/src/pages/startGame.jsx | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/frontend/src/pages/createCharacter.jsx b/frontend/src/pages/createCharacter.jsx index f91da03..f677da7 100644 --- a/frontend/src/pages/createCharacter.jsx +++ b/frontend/src/pages/createCharacter.jsx @@ -75,7 +75,7 @@ const CreateCharacter = () => { try { const response = await axios.post( - 'https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/character/create', + 'http://localhost:5000/games/character/create', formDataToSend, { headers: { diff --git a/frontend/src/pages/createItem.jsx b/frontend/src/pages/createItem.jsx index bd7e97a..ad00689 100644 --- a/frontend/src/pages/createItem.jsx +++ b/frontend/src/pages/createItem.jsx @@ -60,7 +60,7 @@ const CreateItem = () => { try { const response = await axios.post( - 'https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/item/create', + 'http://localhost:5000/games/item/create', formDataToSend, { headers: { diff --git a/frontend/src/pages/createNpc.jsx b/frontend/src/pages/createNpc.jsx index f8d0eaa..f6bd2f5 100644 --- a/frontend/src/pages/createNpc.jsx +++ b/frontend/src/pages/createNpc.jsx @@ -73,7 +73,7 @@ const CreateNpc = () => { try { const response = await axios.post( - 'https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/npc/create', + 'http://localhost:5000/games/npc/create', formDataToSend, { headers: { diff --git a/frontend/src/pages/gameMasterPage.jsx b/frontend/src/pages/gameMasterPage.jsx index e7d7d78..ac47b20 100644 --- a/frontend/src/pages/gameMasterPage.jsx +++ b/frontend/src/pages/gameMasterPage.jsx @@ -25,15 +25,15 @@ const GameMasterPage = () => { useEffect(() => { const fetchData = async () => { try { - const pcsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/playerchars`); + const pcsResponse = await axios.get(`http://localhost:5000/games/${gameId}/playerchars`); const processedPCs = Array.isArray(pcsResponse.data) ? pcsResponse.data : [pcsResponse.data]; setPlayerCharacters(processedPCs.filter(pc => pc !== null)); - const npcsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/npcs`); + const npcsResponse = await axios.get(`http://localhost:5000/games/${gameId}/npcs`); const processedNPCs = Array.isArray(npcsResponse.data) ? npcsResponse.data : [npcsResponse.data]; setNpcs(processedNPCs.filter(npc => npc !== null)); - const itemsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/items`); + const itemsResponse = await axios.get(`http://localhost:5000/games/${gameId}/items`); const processedItems = Array.isArray(itemsResponse.data) ? itemsResponse.data : [itemsResponse.data]; setItems(processedItems.filter(item => item !== null)); } catch (error) { @@ -61,7 +61,7 @@ const GameMasterPage = () => { const fetchOwners = async () => { try { // Only fetch player characters - const pcsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/playerchars`); + const pcsResponse = await axios.get(`http://localhost:5000/games/${gameId}/playerchars`); const pcs = pcsResponse.data.map(pc => ({ id: pc.CharID, @@ -122,7 +122,7 @@ const handleUpdate = async () => { OwnerID: formData.OwnerID, AP: formData.AP }; - response = await axios.put(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/item/${selectedItem.ItemID}`, itemData); + response = await axios.put(`http://localhost:5000/games/item/${selectedItem.ItemID}`, itemData); } else if (editType === 'npc') { // Update NPC data const npcData = { @@ -143,7 +143,7 @@ const handleUpdate = async () => { Level: formData.Level, Allied: formData.Allied }; - response = await axios.put(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/npc/${selectedItem.NpcID}`, npcData); + response = await axios.put(`http://localhost:5000/games/npc/${selectedItem.NpcID}`, npcData); } else if (editType === 'character') { // Update Player Character data const charData = { @@ -164,7 +164,7 @@ const handleUpdate = async () => { level: formData.Level, gold: formData.Gold }; - response = await axios.put(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/character/${selectedItem.CharID}`, charData); + response = await axios.put(`http://localhost:5000/games/character/${selectedItem.CharID}`, charData); } if (response.status === 200) { @@ -172,19 +172,19 @@ const handleUpdate = async () => { const fetchData = async () => { try { // Fetch player characters - const pcsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/playerchars`); + const pcsResponse = await axios.get(`http://localhost:5000/games/${gameId}/playerchars`); setPlayerCharacters( Array.isArray(pcsResponse.data) ? pcsResponse.data : [pcsResponse.data] ); // Fetch NPCs - const npcsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/npcs`); + const npcsResponse = await axios.get(`http://localhost:5000/games/${gameId}/npcs`); setNpcs( Array.isArray(npcsResponse.data) ? npcsResponse.data : [npcsResponse.data] ); // Fetch items - const itemsResponse = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/items`); + const itemsResponse = await axios.get(`http://localhost:5000/games/${gameId}/items`); setItems( Array.isArray(itemsResponse.data) ? itemsResponse.data : [itemsResponse.data] ); diff --git a/frontend/src/pages/games.jsx b/frontend/src/pages/games.jsx index 7566ddd..036e59e 100644 --- a/frontend/src/pages/games.jsx +++ b/frontend/src/pages/games.jsx @@ -30,7 +30,7 @@ const GamesPage = () => { const fetchCharacter = async () => { try { console.log(`Fetching character for gameId: ${gameId}, userId: ${userId}`); // Debug output - const response = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/${userId}/character`); + const response = await axios.get(`http://localhost:5000/games/${gameId}/${userId}/character`); console.log('Character data:', response.data); // Debug output setCharacter(response.data); } catch (error) { @@ -40,7 +40,7 @@ const GamesPage = () => { const fetchInventory = async (charId) => { try { - const response = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/${charId}/items`); + const response = await axios.get(`http://localhost:5000/games/${gameId}/${charId}/items`); setInventory(response.data ? [response.data].flat() : []); } catch (error) { console.error('Error fetching inventory:', error); @@ -75,7 +75,7 @@ const GamesPage = () => { try { console.log('Checking if user is game master...'); - const response = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/master`); + const response = await axios.get(`http://localhost:5000/games/${gameId}/master`); console.log('Game data:', response.data); console.log('User ID:', userId); console.log('Game master ID:', response.data.game_master_id); @@ -103,7 +103,7 @@ const GamesPage = () => { const handleSaveDescription = async () => { try { - const response = await axios.put(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${gameId}/${userId}/character`, { description: newDescription }); + const response = await axios.put(`http://localhost:5000/games/${gameId}/${userId}/character`, { description: newDescription }); setCharacter({ ...character, description: newDescription }); setIsEditOpen(false); } catch (error) { diff --git a/frontend/src/pages/joinGame.jsx b/frontend/src/pages/joinGame.jsx index 1bdc1d3..30f273e 100644 --- a/frontend/src/pages/joinGame.jsx +++ b/frontend/src/pages/joinGame.jsx @@ -19,7 +19,7 @@ const JoinGamePage = () => { } try { - const response = await axios.post(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/joinGame/${gameCode}`, { userId }); + const response = await axios.post(`http://localhost:5000/joinGame/${gameCode}`, { userId }); if (response.status === 201) { setError(''); navigate(`/games/${gameCode}`); // Redirect to the games page diff --git a/frontend/src/pages/login.jsx b/frontend/src/pages/login.jsx index 8827f5c..6143728 100644 --- a/frontend/src/pages/login.jsx +++ b/frontend/src/pages/login.jsx @@ -13,7 +13,7 @@ function Login({ setIsLoggedIn }) { const handleLogin = async (e) => { e.preventDefault(); try { - const res = await axios.post('https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/login', { username, password }); + const res = await axios.post('http://localhost:5000/login', { username, password }); setMessage(res.data.message); if (res.data.success) { setIsLoggedIn(true); diff --git a/frontend/src/pages/profile.jsx b/frontend/src/pages/profile.jsx index 754e31d..8f031ca 100644 --- a/frontend/src/pages/profile.jsx +++ b/frontend/src/pages/profile.jsx @@ -12,7 +12,7 @@ const Profile = () => { useEffect(() => { const fetchCharacters = async () => { try { - const response = await axios.get(`https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/games/${userId}/characters`); + const response = await axios.get(`http://localhost:5000/games/${userId}/characters`); const charactersArray = Object.values(response.data); setCharacters(charactersArray); } catch (error) { diff --git a/frontend/src/pages/register.jsx b/frontend/src/pages/register.jsx index eaaf798..d567b50 100644 --- a/frontend/src/pages/register.jsx +++ b/frontend/src/pages/register.jsx @@ -12,7 +12,7 @@ function Register({ setIsLoggedIn }) { const handleRegister = async (e) => { e.preventDefault(); try { - const res = await axios.post('https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/register', { username, email, password }); + const res = await axios.post('http://localhost:5000/register', { username, email, password }); setMessage(res.data.message); setIsLoggedIn(true); navigate('/'); diff --git a/frontend/src/pages/startGame.jsx b/frontend/src/pages/startGame.jsx index ef59f11..0fa1244 100644 --- a/frontend/src/pages/startGame.jsx +++ b/frontend/src/pages/startGame.jsx @@ -30,7 +30,7 @@ const StartGame = () => { } try { - const response = await fetch('https://congenial-waddle-9w9749vg9q9cr49-5000.app.github.dev/createGame', { + const response = await fetch('http://localhost:5000/createGame', { method: 'POST', headers: { 'Content-Type': 'application/json',