upd: notifikasi

Deskripsi:
- update notifikasi push routing ketika di klik

No Issues
This commit is contained in:
amel
2025-06-26 14:30:40 +08:00
parent 76c0ba0535
commit 32908e1362
6 changed files with 105 additions and 68 deletions

14
lib/notificationSlice.ts Normal file
View File

@@ -0,0 +1,14 @@
import { createSlice } from '@reduxjs/toolkit';
const notificationUpdate = createSlice({
name: 'notificationUpdate',
initialState: false,
reducers: {
setUpdateNotification: (state, action) => {
return action.payload;
},
},
});
export const { setUpdateNotification } = notificationUpdate.actions;
export default notificationUpdate.reducer;

28
lib/pushToPage.ts Normal file
View File

@@ -0,0 +1,28 @@
import { router } from "expo-router"
export function pushToPage(category: string, idContent: string) {
const cat = category.split('/')
if (cat.length > 1) {
if (cat[2] == 'calendar') {
return router.push(`/division/${cat[1]}/calendar/${idContent}`)
} else if (cat[2] == 'discussion') {
return router.push(`/division/${cat[1]}/discussion/${idContent}`)
} else if (cat[2] == 'document') {
return router.push(`/division/${cat[1]}/document/${idContent}`)
} else if (cat[2] == 'task') {
return router.push(`/division/${cat[1]}/task/${idContent}`)
}
} else {
if (cat[0] == 'announcement') {
return router.push(`/announcement/${idContent}`)
} else if (cat[0] == 'discussion-general') {
return router.push(`/discussion/${idContent}`)
} else if (cat[0] == 'division') {
return router.push(`/division/${idContent}`)
} else if (cat[0] == 'member') {
return router.push(`/member/${idContent}`)
} else if (cat[0] == 'project') {
return router.push(`/project/${idContent}`)
}
}
}

View File

@@ -12,6 +12,7 @@ import filterSlice from './filterSlice';
import groupUpdate from './groupSlice';
import memberChoose from './memberChoose';
import memberUpdate from './memberSlice';
import notificationUpdate from './notificationSlice';
import positionUpdate from './positionSlice';
import projectUpdate from './projectUpdate';
import taskCreate from './taskCreate';
@@ -38,6 +39,7 @@ const store = configureStore({
taskUpdate: taskUpdate,
divisionCreate: divisionCreate,
dokumenUpdate: dokumenUpdate,
notificationUpdate: notificationUpdate,
}
});