Skip to content

Commit 679022d

Browse files
Resolve add bug
1 parent 4163b87 commit 679022d

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

app/components/Applications.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const Applications = () => {
8787
<CardHeader
8888
avatar={
8989
<IconButton
90+
ref={delRef}
9091
className={classes.hover}
9192
aria-label="Delete"
9293
onClick={(event: React.MouseEvent<HTMLElement>) => confirmDelete(app[0], i)}

app/context/DashboardContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const DashboardContextProvider = ({ children }: Props) => {
5555
*/
5656
const deleteApp = (index: number) => {
5757
const result = ipcRenderer.sendSync('deleteApp', index);
58+
console.log('what is the res', result);
59+
console.log('what is the string', JSON.stringify(result));
5860
setApplications(result);
5961
};
6062

electron/routes/dashboard.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ipcMain.on('addApp', (message: IpcMainEvent, application: any) => {
2828
fs.writeFileSync(path.resolve(__dirname, '../user/settings.json'), JSON.stringify(state));
2929

3030
// Sync event - return new applications list
31-
message.returnValue = state.services.map((arr: string[]) => arr[0]);
31+
message.returnValue = state.services.map((arr: string[]) => [arr[0], arr[3], arr[4]]);
3232
});
3333

3434
/**
@@ -62,15 +62,17 @@ ipcMain.on('deleteApp', (message: IpcMainEvent, index) => {
6262
);
6363

6464
// Remove application from settings.json
65+
console.log('before state', state)
6566
state.services.splice(index, 1);
67+
console.log('after state', state)
6668

6769
// Update settings.json with new list
6870
fs.writeFileSync(path.resolve(__dirname, '../user/settings.json'), JSON.stringify(state), {
6971
encoding: 'utf8',
7072
});
7173

7274
// Sync event - return new applications list
73-
message.returnValue = state.services.map((arr: string[]) => arr[0]);
75+
message.returnValue = state.services.map((arr: string[]) => [arr[0], arr[3], arr[4]]);
7476
});
7577

7678
// module.exports = dashboard;

0 commit comments

Comments
 (0)