Skip to content

Commit e79599b

Browse files
authored
Merge pull request #239 from boostcampwm-2024/feature-dev-hotfix
[Feature-dev-hotfix] 인코딩 문제 및 로그인 문제 해결
2 parents 3304aa0 + 397c270 commit e79599b

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

client/src/api/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ instance.interceptors.response.use(
5858
originalRequest.headers["Authorization"] = `Bearer ${newAccessToken.accessToken}`;
5959
return instance(originalRequest);
6060
} catch (error) {
61+
await signOut();
62+
useConnectionStore.getState().logout();
6163
return Promise.reject(error);
6264
}
6365
}

client/src/store/createAuthSlice.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const createAuthSlice: StateCreator<ConnectionStore, [], [], AuthSlice> =
2222
logout: () => {
2323
set({ email: null, name: null, token: "" });
2424
get().resetOwnedMindMap();
25+
location.href = "/";
2526
},
2627

2728
setUser: (email: string, name: string, id: number) => {

client/src/store/createSharedSlice.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const createSharedSlice: StateCreator<ConnectionStore, [], [], SharedSlic
2020
get().token
2121
? get().addOwnedMindMap(newMindMapConnectionId)
2222
: get().addOwnedMindMapForGuest(newMindMapConnectionId);
23+
get().connectSocket(newMindMapConnectionId);
2324
navigate(`/mindmap/${newMindMapConnectionId}?mode=${targetMode}`);
2425
} catch (error) {
2526
throw error;

client/src/store/createSocketSlice.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export const createSocketSlice: StateCreator<ConnectionStore, [], [], SocketSlic
103103
if (socket) socket.disconnect();
104104
const response = await createMindmap();
105105
const connectionId = response.data.connectionId;
106-
get().connectSocket(connectionId);
107106
return connectionId;
108107
} catch (error) {
109108
throw error;

client/src/utils/formData.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
export function audioFormData(file: File, mindmapId: string, connectionId: string) {
22
const formData = new FormData();
3-
formData.append("aiAudio", file);
3+
4+
const encodedFileName = encodeURIComponent(file.name);
5+
const encodedFile = new File([file], encodedFileName, { type: file.type });
6+
7+
formData.append("aiAudio", encodedFile);
48
formData.append("mindmapId", mindmapId);
59
formData.append("connectionId", connectionId);
10+
611
return formData;
712
}

0 commit comments

Comments
 (0)