Adresses des serveurs dans un fichier général (temporaire) + reset du graphe même en solo

pull/83/head
Thomas Chazot 1 year ago
parent 31885d7910
commit 3868212543

@ -124,7 +124,7 @@ io.on('connection', (socket) => {
socket.on("reset graph", (id) => {
io.to(id).emit("reset graph")
})
})
socket.on("end game", (winnerIndex, room) =>{
io.to(room).emit("end game", winnerIndex)

@ -0,0 +1,7 @@
const ADRESSE_WEBSERVER = "http://localhost:3002"
const ADRESSE_DBSERVER = "http://localhost:3003"
const ADRESSE_WEBSITE = ""
export {ADRESSE_DBSERVER, ADRESSE_WEBSERVER, ADRESSE_WEBSITE}

@ -45,7 +45,6 @@ const MyGraphComponent: React.FC<MyGraphComponentProps> = ({onNodeClick, handleS
let cptTour: number = 0
const {isLoggedIn, user} = useAuth()
console.log('isLoggedIn : ' + isLoggedIn);
const { indices, indice, person, personNetwork, setNodeIdData, players, askedPersons, setActualPlayerIndexData, room, actualPlayerIndex, turnPlayerIndex, setTurnPlayerIndexData, setWinnerData } = useGame();
const params = new URLSearchParams(window.location.search);
@ -258,6 +257,12 @@ let cptTour: number = 0
setNetwork(network)
socket.on("reset graph", () => {
console.log("reset graph")
initialOptions.physics.enabled = true
network.setOptions(initialOptions)
})
if (!solo){
socket.on("asked all", (id) =>{
const pers = personNetwork.getPersons().find((p) => p.getId() == id)
@ -279,11 +284,6 @@ let cptTour: number = 0
networkData.nodes.update({id: node.id, opacity: 1})
});
})
socket.on("reset graph", () => {
initialOptions.physics.enabled = true
network.setOptions(initialOptions)
})
socket.on("node checked",(id, works, askedIndex, newPlayerIndex, socketId) => {
console.log(newPlayerIndex)
@ -457,7 +457,6 @@ let cptTour: number = 0
setPlayerTouched(-1)
setWinnerData(players[winnerIndex])
console.log('isLoggedIn : ' + isLoggedIn);
if(isLoggedIn){
if(solo){

@ -1,6 +1,7 @@
import { io } from "socket.io-client";
import {ADRESSE_WEBSERVER} from "./AdressConfig"
const socket = io("http://localhost:3002");
const socket = io(ADRESSE_WEBSERVER);
export {socket}

@ -1,4 +1,6 @@
import VerificationService from './VerificationService';
import {ADRESSE_DBSERVER} from "../AdressConfig"
class AuthService{
// Méthode pour vérifier les données de connexion
@ -12,7 +14,7 @@ class AuthService{
static async signUp(data: any) {
try {
const response = await fetch('http://localhost:3003/auth/signup', {
const response = await fetch(ADRESSE_DBSERVER + '/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -36,7 +38,7 @@ class AuthService{
static async signIn(data: any) {
try {
const response = await fetch('http://localhost:3003/auth/signin', {
const response = await fetch(ADRESSE_DBSERVER + '/auth/signin', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@ -61,7 +63,7 @@ class AuthService{
static async logout() {
try {
const response = await fetch('http://localhost:3003/auth/logout', {
const response = await fetch(ADRESSE_DBSERVER + '/auth/logout', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',

@ -1,7 +1,9 @@
import {ADRESSE_DBSERVER} from "../AdressConfig"
class SessionService {
static async getSession() {
try {
const response = await fetch('http://localhost:3003/session', {
const response = await fetch(ADRESSE_DBSERVER + '/session', {
method: 'GET',
headers: {
'Content-Type': 'application/json',

@ -2,4 +2,16 @@
node server/server.js &
node src/server/server.js &
node src/server/server.js
if lsof -Pi :3002 -sTCP:LISTEN -t >/dev/null; then
# Tuer le processus associé au port
pid=$(lsof -Pi :3002 -sTCP:LISTEN -t)
kill -9 $pid
fi
if lsof -Pi :3003 -sTCP:LISTEN -t >/dev/null; then
# Tuer le processus associé au port
pid=$(lsof -Pi :3003 -sTCP:LISTEN -t)
kill -9 $pid
fi
Loading…
Cancel
Save