Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions client/src/store/createAuthSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const createAuthSlice: StateCreator<ConnectionStore, [], [], AuthSlice> =
logout: () => {
set({ email: null, name: null, token: "" });
get().resetOwnedMindMap();
location.href = "/";
},

setUser: (email: string, name: string, id: number) => {
Expand Down
1 change: 1 addition & 0 deletions client/src/store/createSharedSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const createSharedSlice: StateCreator<ConnectionStore, [], [], SharedSlic
get().token
? get().addOwnedMindMap(newMindMapConnectionId)
: get().addOwnedMindMapForGuest(newMindMapConnectionId);
get().connectSocket(newMindMapConnectionId);
navigate(`/mindmap/${newMindMapConnectionId}?mode=${targetMode}`);
} catch (error) {
throw error;
Expand Down
1 change: 0 additions & 1 deletion client/src/store/createSocketSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export const createSocketSlice: StateCreator<ConnectionStore, [], [], SocketSlic
if (socket) socket.disconnect();
const response = await createMindmap();
const connectionId = response.data.connectionId;
get().connectSocket(connectionId);
return connectionId;
} catch (error) {
throw error;
Expand Down
7 changes: 6 additions & 1 deletion client/src/utils/formData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
export function audioFormData(file: File, mindmapId: string, connectionId: string) {
const formData = new FormData();
formData.append("aiAudio", file);

const encodedFileName = encodeURIComponent(file.name);
const encodedFile = new File([file], encodedFileName, { type: file.type });

formData.append("aiAudio", encodedFile);
formData.append("mindmapId", mindmapId);
formData.append("connectionId", connectionId);

return formData;
}