delete all console log, hide join when pass
This commit is contained in:
parent
49f3626948
commit
00a8c9567f
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/17 01:00:00 by apommier #+# #+# */
|
/* Created: 2023/06/17 01:00:00 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/28 16:50:11 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:43:13 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -50,7 +50,6 @@ export class AppController {
|
|||||||
@Post('/logout')
|
@Post('/logout')
|
||||||
async logout(@Request() req, @Body() data: any) {
|
async logout(@Request() req, @Body() data: any) {
|
||||||
const user = await this.userService.findOne(req.user.username)
|
const user = await this.userService.findOne(req.user.username)
|
||||||
// return await this.userService.refuseInvite(user, data.username);
|
|
||||||
if(!user)
|
if(!user)
|
||||||
return ;
|
return ;
|
||||||
if (user.sessionNumber === 1)
|
if (user.sessionNumber === 1)
|
||||||
@ -304,7 +303,6 @@ export class AppController {
|
|||||||
return ;
|
return ;
|
||||||
if (user.sessionNumber > 0)
|
if (user.sessionNumber > 0)
|
||||||
user.sessionNumber--;
|
user.sessionNumber--;
|
||||||
console.log("seesion number=", user.sessionNumber)
|
|
||||||
if (!user.sessionNumber)
|
if (!user.sessionNumber)
|
||||||
user.status = 0;
|
user.status = 0;
|
||||||
await this.userService.save(user);
|
await this.userService.save(user);
|
||||||
@ -423,15 +421,12 @@ export class AppController {
|
|||||||
text: data.text,
|
text: data.text,
|
||||||
id: null,
|
id: null,
|
||||||
}
|
}
|
||||||
console.log(data);
|
|
||||||
return await this.chatService.createMessage(message, req.user.username);
|
return await this.chatService.createMessage(message, req.user.username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post('/member')
|
@Post('/member')
|
||||||
async getMember(@Body() data: any) {
|
async getMember(@Body() data: any) {
|
||||||
console.log(data);
|
|
||||||
console.log(`get member= ${data.convId}`);
|
|
||||||
return await this.chatService.findConv(data.convId);
|
return await this.chatService.findConv(data.convId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,14 +445,12 @@ export class AppController {
|
|||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post('/password')
|
@Post('/password')
|
||||||
async setPassword(@Body() data: any) {
|
async setPassword(@Body() data: any) {
|
||||||
// console.log("PASSSSSSSSSSSSSSSSSSSSSSSSSSs= ", data.password);
|
|
||||||
return await this.chatService.setPassword(data.convId, data.password)
|
return await this.chatService.setPassword(data.convId, data.password)
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post('/verifyPassword')
|
@Post('/verifyPassword')
|
||||||
async verifyPassword(@Request() req, @Body() data: any) {
|
async verifyPassword(@Request() req, @Body() data: any) {
|
||||||
// const user = await this.userService.findOne(req.user.username);
|
|
||||||
return await this.chatService.verifyPassword(data.convId, data.password, req.user.username)
|
return await this.chatService.verifyPassword(data.convId, data.password, req.user.username)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +487,6 @@ export class AppController {
|
|||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post('/isAdmin')
|
@Post('/isAdmin')
|
||||||
async isAdmin(@Request() req, @Body() data: any) {
|
async isAdmin(@Request() req, @Body() data: any) {
|
||||||
console.log("isdamin= ", req.user.username, " id=", data.convId)
|
|
||||||
return await this.chatService.isAdmin(data.convId, req.user.username)
|
return await this.chatService.isAdmin(data.convId, req.user.username)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,12 +21,7 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async login(user: User) {
|
async login(user: User) {
|
||||||
// const myJSON = JSON.stringify(user);
|
|
||||||
// console.log(`in login all user= ${myJSON}`)
|
|
||||||
console.log(`in login user= ${user.username}`)
|
|
||||||
const payload = { username: user.username, sub: user.userId };
|
const payload = { username: user.username, sub: user.userId };
|
||||||
console.log(`in login payload name= ${payload.username}`)
|
|
||||||
console.log(`in login payload sub= ${payload.sub}`)
|
|
||||||
return {
|
return {
|
||||||
access_token: this.jwtService.sign(payload),
|
access_token: this.jwtService.sign(payload),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,8 +14,6 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async validate(payload: any) {
|
async validate(payload: any) {
|
||||||
console.log("in validate function")
|
|
||||||
console.log(`userid= ${payload.sub} nickname= ${payload.username}`)
|
|
||||||
return { userId: payload.sub, username: payload.username };
|
return { userId: payload.sub, username: payload.username };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,6 @@ export class loginClass {
|
|||||||
otp_base32: null,
|
otp_base32: null,
|
||||||
children: null,
|
children: null,
|
||||||
status: 1,
|
status: 1,
|
||||||
// doubleAuth: 0,
|
|
||||||
otp_enabled: false,
|
otp_enabled: false,
|
||||||
otp_verified: false,
|
otp_verified: false,
|
||||||
friendRequest: null,
|
friendRequest: null,
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/17 01:00:25 by apommier #+# #+# */
|
/* Created: 2023/06/17 01:00:25 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/26 10:17:36 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:43:35 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -153,13 +153,11 @@ async isAdmin(convId: number, username: string) {
|
|||||||
conv.admin = conv.admin || [];
|
conv.admin = conv.admin || [];
|
||||||
if (conv.admin.find(item => item === username))
|
if (conv.admin.find(item => item === username))
|
||||||
return (1);
|
return (1);
|
||||||
console.log("nope");
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setPrivate(convId: number, bool: boolean) {
|
async setPrivate(convId: number, bool: boolean) {
|
||||||
const conv = await this.findConv(convId);
|
const conv = await this.findConv(convId);
|
||||||
console.log("bool= ", bool);
|
|
||||||
conv.private = bool;
|
conv.private = bool;
|
||||||
this.save(conv);
|
this.save(conv);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* config.service.ts :+: :+: :+: */
|
/* config.service.ts :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/09 14:53:49 by apommier #+# #+# */
|
/* Created: 2023/04/09 14:53:49 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/24 15:09:20 by sadjigui ### ########.fr */
|
/* Updated: 2023/06/28 17:41:26 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,8 +20,6 @@ export const getTypeOrmConfig = (): TypeOrmModuleOptions => ({
|
|||||||
password: process.env.POSTGRES_PASSWORD || 'postgres',
|
password: process.env.POSTGRES_PASSWORD || 'postgres',
|
||||||
database: process.env.POSTGRES_DATABASE || 'postgres',
|
database: process.env.POSTGRES_DATABASE || 'postgres',
|
||||||
entities: ["dist/**/*.entity.js"],
|
entities: ["dist/**/*.entity.js"],
|
||||||
// entities: [join(__dirname, '**', '*.entity.{ts,js}')]
|
|
||||||
// entities: ['**/*.entity{.ts,.js}'], //basic
|
|
||||||
migrationsTableName: 'migration',
|
migrationsTableName: 'migration',
|
||||||
migrations: ['src/migration/*.ts'],
|
migrations: ['src/migration/*.ts'],
|
||||||
ssl: process.env.MODE !== 'DEV',
|
ssl: process.env.MODE !== 'DEV',
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import * as session from 'express-session';
|
|||||||
import * as dotenv from 'dotenv';
|
import * as dotenv from 'dotenv';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
console.log(process.env);
|
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
|
|||||||
@ -1,19 +1,6 @@
|
|||||||
// item.entity.ts
|
|
||||||
// import { BaseEntity } from './base.entity';
|
|
||||||
|
|
||||||
// @Column({ type: 'varchar', length: 300 , nullable: true})
|
|
||||||
// name: string;
|
|
||||||
|
|
||||||
// @Column({ type: 'varchar', length: 300 , nullable: true})
|
|
||||||
// description: string;
|
|
||||||
|
|
||||||
|
|
||||||
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
|
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
import { ManyToOne, OneToMany } from 'typeorm';
|
import { ManyToOne, OneToMany } from 'typeorm';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Entity({ name: 'User' })
|
@Entity({ name: 'User' })
|
||||||
export class User {
|
export class User {
|
||||||
|
|
||||||
@ -56,7 +43,7 @@ export class User {
|
|||||||
@Column({ default: 0 })
|
@Column({ default: 0 })
|
||||||
rank: number;
|
rank: number;
|
||||||
|
|
||||||
@Column({ default: 0 }) //0 = offline | 1 = connected | 2 = in game
|
@Column({ default: 0 })
|
||||||
status: number;
|
status: number;
|
||||||
|
|
||||||
@Column({ default: 0 })
|
@Column({ default: 0 })
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/17 01:00:07 by apommier #+# #+# */
|
/* Created: 2023/06/17 01:00:07 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/26 07:52:08 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:43:46 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -59,7 +59,6 @@ export class UsersService {
|
|||||||
const user = await this.findOne(username)
|
const user = await this.findOne(username)
|
||||||
let friendsTab = user.friends || [];
|
let friendsTab = user.friends || [];
|
||||||
const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]);
|
const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]);
|
||||||
console.log(friends)
|
|
||||||
return (friends)
|
return (friends)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +79,7 @@ export class UsersService {
|
|||||||
async getInvite(username: string) {
|
async getInvite(username: string) {
|
||||||
const user = await this.findOne(username)
|
const user = await this.findOne(username)
|
||||||
let friendsTab = user.friendRequest
|
let friendsTab = user.friendRequest
|
||||||
console.log(friendsTab)
|
|
||||||
const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]);
|
const friends = await this.userRepository.query("SELECT * FROM \"User\" WHERE username = ANY ($1);", [friendsTab]);
|
||||||
console.log(friends)
|
|
||||||
return (friends)
|
return (friends)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,6 @@ banUser(client: any, payload: any): void {
|
|||||||
}
|
}
|
||||||
const bannedClients = this.clientsNames.get(payload.username);
|
const bannedClients = this.clientsNames.get(payload.username);
|
||||||
bannedClients.forEach(client => {
|
bannedClients.forEach(client => {
|
||||||
console.log("Banning client:", client);
|
|
||||||
console.log("clietn socket=", this.clients[client])
|
|
||||||
this.clients[client].emit('ban', payload);
|
this.clients[client].emit('ban', payload);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -106,8 +104,6 @@ muteUser(client: any, payload: any): void {
|
|||||||
{
|
{
|
||||||
if (targetClient && targetClient !== client.id)
|
if (targetClient && targetClient !== client.id)
|
||||||
this.clients[targetClient].emit('message', payload)
|
this.clients[targetClient].emit('message', payload)
|
||||||
else
|
|
||||||
console.log("not sending");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import * as socketio from 'socket.io';
|
|||||||
import * as dotenv from 'dotenv';
|
import * as dotenv from 'dotenv';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
console.log(process.env);
|
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import * as socketio from 'socket.io';
|
|||||||
import * as dotenv from 'dotenv';
|
import * as dotenv from 'dotenv';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
console.log(process.env);
|
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/19 15:18:38 by apommier #+# #+# */
|
/* Created: 2023/06/19 15:18:38 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/26 07:04:47 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:46:12 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ export class PongGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
|
|||||||
|
|
||||||
@SubscribeMessage('pong:disconnect')
|
@SubscribeMessage('pong:disconnect')
|
||||||
disconnectClient(client: Socket, payload: any): void {
|
disconnectClient(client: Socket, payload: any): void {
|
||||||
console.log("disconnect forced client= ", client.id)
|
console.log("Forced disconnect client= ", client.id)
|
||||||
|
|
||||||
for (const key in this.clients) {
|
for (const key in this.clients) {
|
||||||
if (this.clients.hasOwnProperty(key) && this.clients[key] === client)
|
if (this.clients.hasOwnProperty(key) && this.clients[key] === client)
|
||||||
@ -184,8 +184,6 @@ addPrivateParty(client: Socket, payload: any): void {
|
|||||||
@SubscribeMessage('pong:power')
|
@SubscribeMessage('pong:power')
|
||||||
sendPower(client: Socket, payload: any): void
|
sendPower(client: Socket, payload: any): void
|
||||||
{
|
{
|
||||||
console.log(`from: ${client.id}`);
|
|
||||||
|
|
||||||
const game = this.games.get(payload.gameId);
|
const game = this.games.get(payload.gameId);
|
||||||
const playersIds = game.map(socket => socket.id);
|
const playersIds = game.map(socket => socket.id);
|
||||||
if (playersIds[0] === payload.id)
|
if (playersIds[0] === payload.id)
|
||||||
@ -197,8 +195,6 @@ addPrivateParty(client: Socket, payload: any): void {
|
|||||||
@SubscribeMessage('pong:message')
|
@SubscribeMessage('pong:message')
|
||||||
handleMessage(client: Socket, payload: any): void
|
handleMessage(client: Socket, payload: any): void
|
||||||
{
|
{
|
||||||
console.log(`from: ${client.id}`);
|
|
||||||
|
|
||||||
const game = this.games.get(payload.gameId);
|
const game = this.games.get(payload.gameId);
|
||||||
const playersIds = game.map(socket => socket.id);
|
const playersIds = game.map(socket => socket.id);
|
||||||
if (playersIds[0] === payload.id)
|
if (playersIds[0] === payload.id)
|
||||||
@ -249,7 +245,6 @@ addPrivateParty(client: Socket, payload: any): void {
|
|||||||
{
|
{
|
||||||
const game = this.games.get(payload.gameId);
|
const game = this.games.get(payload.gameId);
|
||||||
const playersIds = game.map(socket => socket.id);
|
const playersIds = game.map(socket => socket.id);
|
||||||
console.log(`id of 0= ${playersIds[0]}`);
|
|
||||||
|
|
||||||
if (playersIds[0] === payload.id)
|
if (playersIds[0] === payload.id)
|
||||||
{
|
{
|
||||||
@ -266,7 +261,6 @@ addPrivateParty(client: Socket, payload: any): void {
|
|||||||
{
|
{
|
||||||
const game = this.games.get(payload.gameId);
|
const game = this.games.get(payload.gameId);
|
||||||
const playersIds = game.map(socket => socket.id);
|
const playersIds = game.map(socket => socket.id);
|
||||||
console.log(`id of 0 mypoint= ${playersIds[0]}`);
|
|
||||||
|
|
||||||
if (playersIds[0] === payload.id)
|
if (playersIds[0] === payload.id)
|
||||||
this.clients[playersIds[1]].emit('pong:hisPoint', payload);
|
this.clients[playersIds[1]].emit('pong:hisPoint', payload);
|
||||||
@ -279,7 +273,7 @@ addPrivateParty(client: Socket, payload: any): void {
|
|||||||
{
|
{
|
||||||
const game = this.games.get(payload.gameId);
|
const game = this.games.get(payload.gameId);
|
||||||
const playersIds = game.map(socket => socket.id);
|
const playersIds = game.map(socket => socket.id);
|
||||||
console.log(`name of client= ${payload.name}`);
|
|
||||||
if (playersIds[0] === payload.id)
|
if (playersIds[0] === payload.id)
|
||||||
{
|
{
|
||||||
this.clients[playersIds[1]].emit('pong:name', payload);
|
this.clients[playersIds[1]].emit('pong:name', payload);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ REACT_APP_SOCKET_URL=paul-f5Ar4s4
|
|||||||
REACT_APP_API_SECRET=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
|
REACT_APP_API_SECRET=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
|
||||||
REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789
|
REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789
|
||||||
|
|
||||||
|
|
||||||
# REACT_APP_BASE_URL=92.143.191.152
|
# REACT_APP_BASE_URL=92.143.191.152
|
||||||
# REACT_APP_BASE_URL=192.168.1.19
|
# REACT_APP_BASE_URL=192.168.1.19
|
||||||
REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fpaul-f5Ar4s4%3A8080%2Fapi%2Fauth%2Flogin&response_type=code"
|
REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fpaul-f5Ar4s4%3A8080%2Fapi%2Fauth%2Flogin&response_type=code"
|
||||||
|
|||||||
@ -22,19 +22,7 @@ import api from "../script/axiosApi.tsx"
|
|||||||
|
|
||||||
|
|
||||||
function AnimatedRoute() {
|
function AnimatedRoute() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// const handleBeforeUnload = async (event: { preventDefault: () => void; returnValue: string; }) => {
|
|
||||||
// console.log("git ")
|
|
||||||
// if (!localStorage.getItem('token'))
|
|
||||||
// return;
|
|
||||||
// try {
|
|
||||||
// await api.post("/quit");
|
|
||||||
// // navigator.sendBeacon("http://" + process.env.REACT_APP_BASE_URL + "/api/quit", {username: user.username})
|
|
||||||
// } catch (err) {
|
|
||||||
// console.log(err);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
const handleLoad = async () => {
|
const handleLoad = async () => {
|
||||||
if (!localStorage.getItem('token'))
|
if (!localStorage.getItem('token'))
|
||||||
return;
|
return;
|
||||||
@ -52,14 +40,7 @@ function AnimatedRoute() {
|
|||||||
return;
|
return;
|
||||||
await api.post("/quit");
|
await api.post("/quit");
|
||||||
});
|
});
|
||||||
// window.addEventListener("unload", async (event) => {
|
return () => {};
|
||||||
// await api.post("/quit");
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
// window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
||||||
};
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
function Footer() {
|
|
||||||
return (
|
|
||||||
<footer className="footer">
|
|
||||||
<p>© 2023 Paris France</p>
|
|
||||||
</footer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Footer;
|
|
||||||
@ -6,17 +6,14 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/09 08:49:24 by apommier #+# #+# */
|
/* Created: 2023/06/09 08:49:24 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/23 17:16:40 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:39:43 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
// import React from "react"
|
|
||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect, useRef } from "react";
|
||||||
// import {Rank} from '../../DataBase/DataRank.js'
|
|
||||||
import DefaultPicture from '../../assets/profile.jpg'
|
import DefaultPicture from '../../assets/profile.jpg'
|
||||||
import api from '../../script/axiosApi.tsx';
|
import api from '../../script/axiosApi.tsx';
|
||||||
import {Matchlog, User} from "../../../interfaces.tsx"
|
import {User} from "../../../interfaces.tsx"
|
||||||
// import { Match } from "@testing-library/react";
|
|
||||||
|
|
||||||
interface RankProps {
|
interface RankProps {
|
||||||
user: User
|
user: User
|
||||||
|
|||||||
@ -75,9 +75,8 @@ const Modal = ({handleClose}: ModalProps) => {
|
|||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
const ret = await api.post("/verifyPassword", {convId: channel, password: PassWord})
|
const ret = await api.post("/verifyPassword", {convId: channel, password: PassWord})
|
||||||
if (ret)
|
if (ret.data)
|
||||||
console.log("ici ret password", ret);
|
window.location.reload();
|
||||||
// window.location.reload();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
@ -100,7 +99,7 @@ const Modal = ({handleClose}: ModalProps) => {
|
|||||||
const joinChannel = async () => {
|
const joinChannel = async () => {
|
||||||
try {
|
try {
|
||||||
await api.post("/join", {convId: channel})
|
await api.post("/join", {convId: channel})
|
||||||
// window.location.reload();
|
window.location.reload();
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
@ -183,12 +182,14 @@ const Modal = ({handleClose}: ModalProps) => {
|
|||||||
|
|
||||||
{askPass ? (
|
{askPass ? (
|
||||||
<input className="mdp" placeholder="password" type="password" onChange={(e) => setPassWord(e.target.value)} onKeyDown={handlePassword}/>
|
<input className="mdp" placeholder="password" type="password" onChange={(e) => setPassWord(e.target.value)} onKeyDown={handlePassword}/>
|
||||||
):("") }
|
):(
|
||||||
|
<div className="div_submit">
|
||||||
|
<Link to='#' className="submit" onClick={ joinChannel }>Join</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="div_submit">
|
|
||||||
<Link to='#' className="submit" onClick={ joinChannel }>Join</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</Backdrop>
|
</Backdrop>
|
||||||
|
|||||||
@ -30,7 +30,6 @@ const ModalEdit = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handlePostNickname = async () => {
|
const handlePostNickname = async () => {
|
||||||
console.log("nickname=", nickname)
|
|
||||||
try {
|
try {
|
||||||
if (nickname.length > 3) {
|
if (nickname.length > 3) {
|
||||||
const ret = await api.post("/nickname", { nickname: nickname });
|
const ret = await api.post("/nickname", { nickname: nickname });
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import React, { useState, useEffect, useRef } from "react";
|
|||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import api from '../../script/axiosApi.tsx';
|
import api from '../../script/axiosApi.tsx';
|
||||||
|
|
||||||
|
|
||||||
function WinLoss() {
|
function WinLoss() {
|
||||||
|
|
||||||
const [user, setUser] = useState<User>();
|
const [user, setUser] = useState<User>();
|
||||||
@ -16,7 +15,6 @@ function WinLoss() {
|
|||||||
useEffect(()=> {
|
useEffect(()=> {
|
||||||
const getUser = async ()=>{
|
const getUser = async ()=>{
|
||||||
try{
|
try{
|
||||||
console.log("username win loss=", username)
|
|
||||||
let tmpUser;
|
let tmpUser;
|
||||||
let tmpHistory;
|
let tmpHistory;
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/09 08:18:58 by apommier #+# #+# */
|
/* Created: 2023/06/09 08:18:58 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/23 17:12:07 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:46:36 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,7 +16,6 @@ import DefaultPicture from '../../assets/profile.jpg'
|
|||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { RxCircle } from "react-icons/rx";
|
import { RxCircle } from "react-icons/rx";
|
||||||
import { CgFontSpacing } from "react-icons/cg";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {User} from "../../../interfaces.tsx"
|
import {User} from "../../../interfaces.tsx"
|
||||||
|
|
||||||
@ -34,16 +33,10 @@ const UserChat = styled.div `
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const SideP = styled.p`
|
|
||||||
font-size: 14px;
|
|
||||||
color: lightgray;
|
|
||||||
margin-left: 15px;
|
|
||||||
`
|
|
||||||
interface UserProps {
|
interface UserProps {
|
||||||
currentUser: User
|
currentUser: User
|
||||||
}
|
}
|
||||||
|
|
||||||
// export default function Friend({currentUser})
|
|
||||||
export default function Friend({currentUser}: UserProps)
|
export default function Friend({currentUser}: UserProps)
|
||||||
{
|
{
|
||||||
const [profilePicture, setProfilePicture] = useState('');
|
const [profilePicture, setProfilePicture] = useState('');
|
||||||
@ -51,10 +44,7 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProfilePicture = async () => {
|
const fetchProfilePicture = async () => {
|
||||||
try {
|
try {
|
||||||
// const user = await api.get("/profile");
|
|
||||||
const pic = await api.post("/getPicture", {username: currentUser.username})
|
const pic = await api.post("/getPicture", {username: currentUser.username})
|
||||||
// console.log(`user naem profile pic222= ${currentUser.username}`)
|
|
||||||
// console.log(` profile pic222= ${pic.data}`)
|
|
||||||
setProfilePicture(pic.data);
|
setProfilePicture(pic.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching profile picture:', error);
|
console.error('Error fetching profile picture:', error);
|
||||||
@ -67,8 +57,6 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
{
|
{
|
||||||
let status = friend.status
|
let status = friend.status
|
||||||
let session =friend.sessionNumber
|
let session =friend.sessionNumber
|
||||||
console.log(`session= ${session}`)
|
|
||||||
console.log(`status= ${status}`)
|
|
||||||
let statusColor;
|
let statusColor;
|
||||||
|
|
||||||
if (status === 0)
|
if (status === 0)
|
||||||
@ -80,17 +68,8 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
return statusColor;
|
return statusColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSpectate = (user: User) => {
|
|
||||||
//socket connection and add to party with one with username
|
|
||||||
console.log(`spectate hehe`)
|
|
||||||
console.log(`user= ${user}`)
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleButtonClick = (user: User) => {
|
const handleButtonClick = (user: User) => {
|
||||||
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
||||||
console.log("path= ", path)
|
|
||||||
// history(path, { replace: true });
|
|
||||||
// window.location.replace(path);
|
|
||||||
window.history.pushState({}, '', path);
|
window.history.pushState({}, '', path);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
@ -111,9 +90,3 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
</UserChat>
|
</UserChat>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// spectate visible
|
|
||||||
// {getStatus(currentUser) !== 'blue' ? (
|
|
||||||
// <></>
|
|
||||||
// ) : (
|
|
||||||
// <button className="friendRequest" onClick={() => handleSpectate(currentUser)} >Spectate</button>
|
|
||||||
// )}
|
|
||||||
|
|||||||
@ -21,12 +21,6 @@ const UserChat = styled.div `
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const SideP = styled.p`
|
|
||||||
font-size: 14px;
|
|
||||||
color: lightgray;
|
|
||||||
margin-left: 15px;
|
|
||||||
`
|
|
||||||
|
|
||||||
interface UserProps {
|
interface UserProps {
|
||||||
currentUser: User
|
currentUser: User
|
||||||
}
|
}
|
||||||
@ -36,19 +30,13 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
const [profilePicture, setProfilePicture] = useState('');
|
const [profilePicture, setProfilePicture] = useState('');
|
||||||
const [request, setRequest] = useState<User>(); //user who invite
|
const [request, setRequest] = useState<User>(); //user who invite
|
||||||
const [clickEvent, setClickEvent] = useState(false);
|
const [clickEvent, setClickEvent] = useState(false);
|
||||||
// const [user, setUser] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProfilePicture = async () => {
|
const fetchProfilePicture = async () => {
|
||||||
try {
|
try {
|
||||||
// const user = await api.get("/profile");\
|
|
||||||
// const tmpUser = await api.get("/profile")
|
|
||||||
const pic = await api.post("/getPicture", {username: currentUser.username})
|
const pic = await api.post("/getPicture", {username: currentUser.username})
|
||||||
const tmpRequest = await api.post("/user", {username: currentUser.username})
|
const tmpRequest = await api.post("/user", {username: currentUser.username})
|
||||||
// setUser(tmpUser.data);
|
|
||||||
setRequest(tmpRequest.data);
|
setRequest(tmpRequest.data);
|
||||||
// console.log(`user naem profile pic222= ${currentUser.username}`)
|
|
||||||
// console.log(` profile pic222= ${pic.data}`)
|
|
||||||
setProfilePicture(pic.data);
|
setProfilePicture(pic.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching profile picture:', error);
|
console.error('Error fetching profile picture:', error);
|
||||||
@ -60,8 +48,6 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
|
|
||||||
const handleButtonClick = (user: User) => {
|
const handleButtonClick = (user: User) => {
|
||||||
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
||||||
// history(path, { replace: true });
|
|
||||||
// window.location.replace(path);
|
|
||||||
window.history.pushState({}, '', path);
|
window.history.pushState({}, '', path);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
@ -73,8 +59,7 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
console.log("accept")
|
window.location.reload();
|
||||||
console.log(`request = ${request}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Refuse = async (request: User) => {
|
const Refuse = async (request: User) => {
|
||||||
@ -84,13 +69,11 @@ export default function Friend({currentUser}: UserProps)
|
|||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
console.log("refuse")
|
window.location.reload();
|
||||||
console.log(`request = ${request}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérifier si le contenu doit être caché
|
|
||||||
if (clickEvent) {
|
if (clickEvent) {
|
||||||
return null; // Rendre null pour ne pas afficher le contenu
|
return (<></>);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import DefaultPicture from '../../assets/profile.jpg'
|
|
||||||
import api from '../../script/axiosApi.tsx';
|
import api from '../../script/axiosApi.tsx';
|
||||||
import React, { useState, useEffect, useRef } from "react";
|
import React, { useState, useEffect} from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
|
||||||
@ -8,14 +7,8 @@ import Friend from './Friend.tsx';
|
|||||||
import FriendRequest from './FriendRequest.tsx';
|
import FriendRequest from './FriendRequest.tsx';
|
||||||
|
|
||||||
import {IoMdPeople} from 'react-icons/io'
|
import {IoMdPeople} from 'react-icons/io'
|
||||||
import { ImBlocked } from 'react-icons/im';
|
|
||||||
import { MdOutlineGroupAdd } from 'react-icons/md';
|
|
||||||
import {User} from "../../../interfaces.tsx"
|
import {User} from "../../../interfaces.tsx"
|
||||||
|
|
||||||
// import React from "react";
|
|
||||||
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -52,8 +45,6 @@ function Social (){
|
|||||||
setProfilePicture(pic.data);
|
setProfilePicture(pic.data);
|
||||||
setUser(tmpUser.data);
|
setUser(tmpUser.data);
|
||||||
setFriends(tmpFriends.data);
|
setFriends(tmpFriends.data);
|
||||||
// return tmpUser;
|
|
||||||
console.log(`user= ${tmpUser.data.username}`);
|
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -65,30 +56,9 @@ function Social (){
|
|||||||
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// const { status } = this.props;
|
|
||||||
// let statusColor = '';
|
|
||||||
// // let statusIcon = RxCircle;
|
|
||||||
// let status = 0
|
|
||||||
|
|
||||||
// if (status === 0) {
|
|
||||||
// // statusIcon = faCircle;
|
|
||||||
// statusColor = 'green';
|
|
||||||
// } else if (status === 1) {
|
|
||||||
// // statusIcon = faCircle;
|
|
||||||
// statusColor = 'red';
|
|
||||||
// } else if (status === 2) {
|
|
||||||
// // statusIcon = faCircle;
|
|
||||||
// statusColor = 'blue';
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className='navbarSocial'>
|
<div className='navbarSocial'>
|
||||||
{/* <img src={DefaultPic} alt="profile" className="pic"/> */}
|
|
||||||
<IoMdPeople className="catchat"/>
|
<IoMdPeople className="catchat"/>
|
||||||
<span>
|
<span>
|
||||||
{isLoading || !user ? (
|
{isLoading || !user ? (
|
||||||
@ -100,8 +70,6 @@ function Social (){
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* map with fiend request */}
|
|
||||||
|
|
||||||
{invite.map(c=> (
|
{invite.map(c=> (
|
||||||
<FriendRequest currentUser={c}/>
|
<FriendRequest currentUser={c}/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -44,7 +44,6 @@ function Field()
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const queryParams = queryString.parse(window.location.search);
|
const queryParams = queryString.parse(window.location.search);
|
||||||
|
|
||||||
console.log("launch canva hehe")
|
|
||||||
let Modifiers = 0;
|
let Modifiers = 0;
|
||||||
let info: GameProps;
|
let info: GameProps;
|
||||||
|
|
||||||
@ -66,19 +65,16 @@ function Field()
|
|||||||
}
|
}
|
||||||
if (queryParams.username)
|
if (queryParams.username)
|
||||||
{
|
{
|
||||||
console.log("user= ", queryParams.username)
|
|
||||||
info = {
|
info = {
|
||||||
privateParty: true,
|
privateParty: true,
|
||||||
username: queryParams.username as string,
|
username: queryParams.username as string,
|
||||||
gameId: queryParams.gameId as unknown as number
|
gameId: queryParams.gameId as unknown as number
|
||||||
}
|
}
|
||||||
console.log("info of param vefore canvas=", info)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanup = DrawCanvas(Modifiers, info);
|
const cleanup = DrawCanvas(Modifiers, info);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log("Cleanup");
|
|
||||||
if (cleanup)
|
if (cleanup)
|
||||||
cleanup();
|
cleanup();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/09 08:19:04 by apommier #+# #+# */
|
/* Created: 2023/06/09 08:19:04 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/26 11:31:57 by apommier ### ########.fr */
|
/* Updated: 2023/06/28 17:47:35 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -56,16 +56,13 @@ function Profile () {
|
|||||||
|
|
||||||
useEffect(()=> {
|
useEffect(()=> {
|
||||||
const getUser = async ()=>{
|
const getUser = async ()=>{
|
||||||
console.log(`username= ${username}`)
|
|
||||||
let pic;
|
let pic;
|
||||||
try{
|
try{
|
||||||
console.log("before request")
|
|
||||||
const me = await api.get("/profile")
|
const me = await api.get("/profile")
|
||||||
if (!username)
|
if (!username)
|
||||||
{
|
{
|
||||||
setMine(true);
|
setMine(true);
|
||||||
setUser(me.data);
|
setUser(me.data);
|
||||||
console.log(`mine= true = ${mine}`)
|
|
||||||
pic = await api.post("/getPicture", {username: me.data.username}) //good one?
|
pic = await api.post("/getPicture", {username: me.data.username}) //good one?
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -82,7 +82,7 @@ function QrCode () {
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console.log("bad code")
|
console.log("Bad code")
|
||||||
}
|
}
|
||||||
catch(err){
|
catch(err){
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
|||||||
@ -108,7 +108,6 @@ socket.on('pong:win', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('pong:privateId', async (data) => {
|
socket.on('pong:privateId', async (data) => {
|
||||||
console.log("private id = ", data)
|
|
||||||
try{
|
try{
|
||||||
await api.post("/partyInvite", {username: gameParam.username, gameId: data});
|
await api.post("/partyInvite", {username: gameParam.username, gameId: data});
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@ -376,11 +375,8 @@ socket.on('pong:hisPoint', (data) => {
|
|||||||
const stopDrawCanvas = async () => {
|
const stopDrawCanvas = async () => {
|
||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
console.log("stopDrawCanvas 1")
|
|
||||||
|
|
||||||
if (gameParam.privateParty && !gameId) //delete invite
|
if (gameParam.privateParty && !gameId) //delete invite
|
||||||
{
|
{
|
||||||
console.log("stopDrawCanvas2")
|
|
||||||
try{
|
try{
|
||||||
await api.post('/status', {status: 1});
|
await api.post('/status', {status: 1});
|
||||||
await api.post("deleteInvite", {username: gameParam.username})
|
await api.post("deleteInvite", {username: gameParam.username})
|
||||||
@ -585,7 +581,6 @@ async function draw(timestamp: number)
|
|||||||
else if (event.code === "KeyW")
|
else if (event.code === "KeyW")
|
||||||
{
|
{
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
console.log("last time =", date.getTime() - lastPower)
|
|
||||||
if (date.getTime() - lastPower < 15000)//10000 + 5000
|
if (date.getTime() - lastPower < 15000)//10000 + 5000
|
||||||
return ;
|
return ;
|
||||||
if (!superpowerModifier)
|
if (!superpowerModifier)
|
||||||
|
|||||||
@ -3,14 +3,9 @@ import axios from 'axios';
|
|||||||
|
|
||||||
function getToken() {
|
function getToken() {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
if (typeof token === 'string') {
|
|
||||||
console.log("is a string !!!")
|
|
||||||
}
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`getToken = ${getToken()}`)
|
|
||||||
console.log(`Bearer ${localStorage.getItem("token")}`)
|
|
||||||
let api = axios.create({
|
let api = axios.create({
|
||||||
baseURL: 'http://' + process.env.REACT_APP_BASE_URL + '/api',
|
baseURL: 'http://' + process.env.REACT_APP_BASE_URL + '/api',
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ function SuccessToken() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
console.log("No data");
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ function SuccessToken() {
|
|||||||
window.location.replace("http://" + process.env.REACT_APP_BASE_URL + "/pong");
|
window.location.replace("http://" + process.env.REACT_APP_BASE_URL + "/pong");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
console.log("bad code")
|
console.log("Bad code")
|
||||||
}
|
}
|
||||||
catch(err){
|
catch(err){
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user