fix: allow moderators to edit all jobs

This commit is contained in:
Jannat Patel
2025-12-02 18:34:46 +05:30
parent b04a3de201
commit 7105d6271f
2 changed files with 12 additions and 5 deletions

View File

@@ -207,6 +207,11 @@ const jobDetail = createResource({
}
},
onSuccess(data) {
if (data.owner != user.data?.name && !user.data?.is_moderator) {
router.push({
name: 'Jobs',
})
}
Object.keys(data).forEach((key) => {
if (Object.hasOwn(job, key)) job[key] = data[key]
})
@@ -242,7 +247,11 @@ const job = reactive({
})
onMounted(() => {
if (!user.data) window.location.href = '/login'
if (!user.data) {
router.push({
name: 'Jobs',
})
}
if (props.jobName != 'new') jobDetail.reload()
})