diff --git a/BE/apps/api-server/src/modules/connection/connection.controller.ts b/BE/apps/api-server/src/modules/connection/connection.controller.ts index f44cd5de..a835d3e7 100644 --- a/BE/apps/api-server/src/modules/connection/connection.controller.ts +++ b/BE/apps/api-server/src/modules/connection/connection.controller.ts @@ -26,7 +26,8 @@ export class ConnectionController { @UseGuards(AuthGuard('jwt')) async getConnection(@Query() queryDto: ConnectionQueryDto, @User() user: UserDto) { const { type, id } = queryDto; - + console.log('type:', type); + console.log('id:', id); switch (type) { case 'connection': return await this.connectionService.getConnection(id as string, user.id); diff --git a/BE/apps/api-server/src/modules/connection/connection.service.ts b/BE/apps/api-server/src/modules/connection/connection.service.ts index aae659b4..ec79f5da 100644 --- a/BE/apps/api-server/src/modules/connection/connection.service.ts +++ b/BE/apps/api-server/src/modules/connection/connection.service.ts @@ -25,7 +25,11 @@ export class ConnectionService { async createGuestConnection() { const connectionId = uuidv4(); - await this.GeneralRedis.hset(connectionId, { type: 'guest' }); + await Promise.all([ + this.GeneralRedis.hset(connectionId, { type: 'guest', aiCount: 0, title: '제목없음' }), + this.GeneralRedis.set(`mindmapState:${connectionId}`, JSON.stringify({})), + this.GeneralRedis.set(`content:${connectionId}`, ''), + ]); return { connectionId, role: 'owner' }; } @@ -39,7 +43,8 @@ export class ConnectionService { async setConnection(mindmapId: number, userId: number) { const role = await this.userService.getRole(userId, mindmapId); - if (!role) { + this.logger.log(`role: ${role}`); + if (role === undefined) { throw new ForbiddenException('권한이 없습니다.'); } diff --git a/BE/apps/api-server/src/modules/user/user.controller.ts b/BE/apps/api-server/src/modules/user/user.controller.ts index 557a01b4..13084fad 100644 --- a/BE/apps/api-server/src/modules/user/user.controller.ts +++ b/BE/apps/api-server/src/modules/user/user.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, UseGuards } from '@nestjs/common'; +import { Controller, Get, UnauthorizedException, UseGuards } from '@nestjs/common'; import { UserService } from './user.service'; import { AuthGuard } from '@nestjs/passport'; import { User } from '../../decorators'; @@ -10,6 +10,10 @@ export class UserController { @Get('info') @UseGuards(AuthGuard('jwt')) async getUserInfo(@User() user) { - return await this.userService.getUserInfo(user.id); + try { + return await this.userService.getUserInfo(user.id); + } catch { + throw new UnauthorizedException(); + } } } diff --git a/client/index.html b/client/index.html index f85276eb..6b06a14f 100644 --- a/client/index.html +++ b/client/index.html @@ -1,5 +1,5 @@ - +
diff --git a/client/src/api/index.ts b/client/src/api/index.ts index bfcb0ee4..b8939f29 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -58,6 +58,8 @@ instance.interceptors.response.use( originalRequest.headers["Authorization"] = `Bearer ${newAccessToken.accessToken}`; return instance(originalRequest); } catch (error) { + await signOut(); + useConnectionStore.getState().logout(); return Promise.reject(error); } } diff --git a/client/src/konva_mindmap/utils/nodeAttrs.ts b/client/src/konva_mindmap/utils/nodeAttrs.ts index c23bb2af..f7562f00 100644 --- a/client/src/konva_mindmap/utils/nodeAttrs.ts +++ b/client/src/konva_mindmap/utils/nodeAttrs.ts @@ -10,7 +10,7 @@ export const TEXT_WIDTH = (depth: number) => NODE_DEFAULT_SIZE * 2 - depth * 18; //CONNECTED_LINE export const CONNECTED_LINE_FROM = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 10; -export const CONNECTED_LINE_TO = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 5; +export const CONNECTED_LINE_TO = (depth: number) => NODE_DEFAULT_SIZE - depth * 7 + 3; //TEXT export const TEXT_FONT_SIZE = 16; diff --git a/client/src/store/createAuthSlice.ts b/client/src/store/createAuthSlice.ts index 2e9bbe7e..300eeaf7 100644 --- a/client/src/store/createAuthSlice.ts +++ b/client/src/store/createAuthSlice.ts @@ -22,6 +22,7 @@ export const createAuthSlice: StateCreator