Skip to content

Commit f0e3e0b

Browse files
ymh6315431minghao.yang
andauthored
feat(evaluations): handle unauthorized access (#1419)
* Draft MR * feat(evaluations): handle unauthorized access --------- Co-authored-by: minghao.yang <mh.yang@opencsg.com>
1 parent b98d067 commit f0e3e0b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/src/components/evaluations/EvaluationDetail.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,14 @@
432432
const fetchEvaluation = async () => {
433433
try {
434434
loading.value = true
435-
const { data } = await useFetchApi(
435+
const { data, response } = await useFetchApi(
436436
`/evaluations/${props.evaluationId}`
437437
).json()
438438
439+
if (response?.status === 403 || data.value?.code === 'AUTH-ERR-2') {
440+
return (window.location.href = '/errors/unauthorized')
441+
}
442+
439443
if (!data.value) {
440444
throw new Error(data.value?.msg || 'Failed to fetch evaluation')
441445
}

0 commit comments

Comments
 (0)