fix(mobile): guard case uploads with employee position
This commit is contained in:
@@ -86,6 +86,7 @@ import type { CaseCurateResponse, CaseOrganizeResponse, CaseRecord, CaseSelected
|
||||
import { chooseCaseAudio, curateCase, getCaseRecords, organizeCase, uploadCaseAudio } from '@/services/case';
|
||||
import { isLoggedIn, rememberLoginRedirect } from '@/services/auth';
|
||||
import { resetPageScroll } from '@/services/navigation';
|
||||
import { ensureEmployeePosition } from '@/services/position';
|
||||
|
||||
const loggedIn = ref(false);
|
||||
const selectedFile = ref<CaseSelectedFile | null>(null);
|
||||
@@ -198,14 +199,21 @@ const formatSize = (size: number) => {
|
||||
return `${(size / 1024 / 1024).toFixed(1)} MB`;
|
||||
};
|
||||
|
||||
onShow(() => {
|
||||
const handleShow = async () => {
|
||||
resetPageScroll();
|
||||
refreshAuthState();
|
||||
if (loggedIn.value) {
|
||||
if (!(await ensureEmployeePosition('/pages/user/cases/index'))) {
|
||||
return;
|
||||
}
|
||||
void loadRecords();
|
||||
} else {
|
||||
clearCaseData();
|
||||
}
|
||||
};
|
||||
|
||||
onShow(() => {
|
||||
void handleShow();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user