mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Fix TS errors in utils (#18463)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Permission } from '../../../packages/shared/types';
|
||||
import type { Permission } from '@directus/types';
|
||||
|
||||
export function isPermissionEmpty(perm: Permission): boolean {
|
||||
return (
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import { Accountability } from '@directus/types';
|
||||
import { Accountability, Filter } from '@directus/types';
|
||||
import { parseFilter as parseFilterShared } from '@directus/utils';
|
||||
import { Filter } from '@directus/types';
|
||||
|
||||
export function parseFilter(filter: Filter | null): Filter {
|
||||
const userStore = useUserStore();
|
||||
|
||||
if (!userStore.currentUser) return filter ?? {};
|
||||
if (!('id' in userStore.currentUser)) return filter ?? {};
|
||||
|
||||
const accountability: Accountability = {
|
||||
role: userStore.currentUser.role.id,
|
||||
|
||||
@@ -6,6 +6,7 @@ export function parsePreset(preset: Record<string, any> | null): Record<string,
|
||||
const { currentUser } = useUserStore();
|
||||
|
||||
if (!currentUser) return preset ?? {};
|
||||
if (!('id' in currentUser)) return preset ?? {};
|
||||
|
||||
const accountability: Accountability = {
|
||||
role: currentUser.role.id,
|
||||
|
||||
@@ -2,6 +2,7 @@ import api from '@/api';
|
||||
import emitter, { Events } from '@/events';
|
||||
import { i18n } from '@/lang';
|
||||
import { notify } from '@/utils/notify';
|
||||
import type { AxiosProgressEvent } from 'axios';
|
||||
import { unexpectedError } from './unexpected-error';
|
||||
|
||||
export async function uploadFile(
|
||||
@@ -50,8 +51,8 @@ export async function uploadFile(
|
||||
unexpectedError(err);
|
||||
}
|
||||
|
||||
function onUploadProgress(progressEvent: { loaded: number; total: number }) {
|
||||
const percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total);
|
||||
function onUploadProgress(progressEvent: AxiosProgressEvent) {
|
||||
const percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total!);
|
||||
progressHandler(percentCompleted);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user