mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
Fixing some type errors in app (#9466)
* Fixing some type errors in app * Remove unused import Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { unexpectedError } from '@/utils/unexpected-error';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { computed, ComputedRef, Ref, ref, watch } from 'vue';
|
||||
import { validatePayload } from '@directus/shared/utils';
|
||||
import { Filter, Item, Field } from '@directus/shared/types';
|
||||
import { Item, Field, LogicalFilterAND } from '@directus/shared/types';
|
||||
import { isNil, flatten, merge } from 'lodash';
|
||||
import { FailedValidationException } from '@directus/shared/exceptions';
|
||||
import { getEndpoint } from '@/utils/get-endpoint';
|
||||
@@ -314,8 +314,8 @@ export function useItem(collection: Ref<string>, primaryKey: Ref<string | number
|
||||
|
||||
function validate(item: Item) {
|
||||
const validationRules = {
|
||||
_and: [] as Filter['_and'],
|
||||
} as Filter;
|
||||
_and: [],
|
||||
} as LogicalFilterAND;
|
||||
|
||||
const applyConditions = (field: Field) => {
|
||||
if (field.meta && Array.isArray(field.meta?.conditions)) {
|
||||
@@ -352,14 +352,14 @@ export function useItem(collection: Ref<string>, primaryKey: Ref<string | number
|
||||
|
||||
for (const field of requiredFields) {
|
||||
if (isNew.value === true && isNil(field.schema?.default_value)) {
|
||||
validationRules._and!.push({
|
||||
validationRules._and.push({
|
||||
[field.field]: {
|
||||
_submitted: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
validationRules._and!.push({
|
||||
validationRules._and.push({
|
||||
[field.field]: {
|
||||
_nnull: true,
|
||||
},
|
||||
|
||||
@@ -90,7 +90,6 @@ export function setSpecialForLocalType(updates: StateUpdates) {
|
||||
|
||||
export function resetRelations(updates: StateUpdates) {
|
||||
if (!updates.relations) updates.relations = {};
|
||||
updates.relations.m2a = undefined;
|
||||
updates.relations.m2o = undefined;
|
||||
updates.relations.o2m = undefined;
|
||||
}
|
||||
|
||||
@@ -210,12 +210,11 @@ export const appMinimalPermissions: Partial<Permission>[] = [
|
||||
{
|
||||
collection: 'directus_presets',
|
||||
action: 'create',
|
||||
validation: [
|
||||
{
|
||||
user: null,
|
||||
validation: {
|
||||
user: {
|
||||
_eq: '$CURRENT_USER',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
collection: 'directus_presets',
|
||||
|
||||
@@ -267,7 +267,7 @@ export const usePresetsStore = defineStore({
|
||||
* the user. If the preset already exists and is for a user, we update the preset.
|
||||
* The response gets added to the store.
|
||||
*/
|
||||
async savePreset(preset: Preset) {
|
||||
async savePreset(preset: Partial<Preset>) {
|
||||
const userStore = useUserStore();
|
||||
if (userStore.currentUser === null) return null;
|
||||
const { id: userID } = userStore.currentUser;
|
||||
|
||||
@@ -22,7 +22,7 @@ export const useSettingsStore = defineStore({
|
||||
},
|
||||
|
||||
async updateSettings(updates: { [key: string]: any }) {
|
||||
const settingsCopy = { ...this.settings };
|
||||
const settingsCopy = { ...(this.settings as Settings) };
|
||||
const newSettings = merge({}, this.settings, updates);
|
||||
|
||||
this.settings = newSettings;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { defineComponent, ref, watch, PropType, computed } from 'vue';
|
||||
import { Filter } from '@directus/shared/types';
|
||||
import { debounce, isObject } from 'lodash';
|
||||
import { isObject } from 'lodash';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user