Skip to content

Commit

Permalink
fix(notification-setting): get projectId from invalid params (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
hudy9x authored Mar 13, 2024
1 parent 7d1eedd commit 587c43f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
4 changes: 3 additions & 1 deletion packages/be-gateway/src/routes/project/setting.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class ProjectSetting extends BaseController {
@Get('/notification')
async getAllNotificationSetting(@Req() req: AuthRequest) {
const { id } = req.authen
const { projectId } = this.req.params as { projectId: string }
const { projectId } = this.req.query as { projectId: string }
try {

console.log('projectid', projectId)

const settings = await this.settingRepo.getMyNotifySettings({
uid: id,
projectId
Expand Down
33 changes: 19 additions & 14 deletions packages/ui-app/app/_features/ProjectSetting/Notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,36 @@ export default function ProjectNotificationSetting() {


useEffect(() => {
setLoading(true)
const abortCtrl = new AbortController()
projectSettingNotify.get(projectId, abortCtrl.signal).then(res => {

if (projectId) {
setLoading(true)
console.log('get projectId', projectId)
projectSettingNotify.get(projectId, abortCtrl.signal).then(res => {

const { data } = res.data
const { overdue, taskChanges, remind } = data as ProjectSettingNotification

const { data } = res.data
const { overdue, taskChanges, remind } = data as ProjectSettingNotification

setData({
overdue: !!overdue,
taskChanges: !!taskChanges,
remind: !!remind,
loading: false

setData({
overdue: !!overdue,
taskChanges: !!taskChanges,
remind: !!remind,
loading: false
})

console.log('project notify setting', data)
}).catch(err => {
setLoading(false)
})

console.log('project notify setting', data)
}).catch(err => {
setLoading(false)
})
}
return () => {
setLoading(false)
abortCtrl.abort()
}
}, [])
}, [projectId])

if (data.loading) {
return (
Expand Down

0 comments on commit 587c43f

Please sign in to comment.