handle put requests correctly
This commit is contained in:
@@ -127,7 +127,7 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
values: model.values,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
DataTypeResource.putDataTypeById({
|
||||
id: model.unique,
|
||||
@@ -135,8 +135,8 @@ export class UmbDataTypeServerDataSource implements UmbDetailDataSource<UmbDataT
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -116,7 +116,7 @@ export class UmbDictionaryServerDataSource implements UmbDetailDataSource<UmbDic
|
||||
translations: model.translations,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
DictionaryResource.putDictionaryById({
|
||||
id: model.unique,
|
||||
@@ -124,8 +124,8 @@ export class UmbDictionaryServerDataSource implements UmbDetailDataSource<UmbDic
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -251,7 +251,7 @@ export class UmbDocumentTypeDetailServerDataSource implements UmbDetailDataSourc
|
||||
cleanup: model.cleanup,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
DocumentTypeResource.putDocumentTypeById({
|
||||
id: model.unique,
|
||||
@@ -259,8 +259,8 @@ export class UmbDocumentTypeDetailServerDataSource implements UmbDetailDataSourc
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -151,7 +151,7 @@ export class UmbDocumentServerDataSource implements UmbDetailDataSource<UmbDocum
|
||||
variants: model.variants,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
DocumentResource.putDocumentById({
|
||||
id: model.unique,
|
||||
@@ -159,8 +159,8 @@ export class UmbDocumentServerDataSource implements UmbDetailDataSource<UmbDocum
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -124,7 +124,7 @@ export class UmbLanguageServerDataSource implements UmbDetailDataSource<UmbLangu
|
||||
name: model.name,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
LanguageResource.putLanguageByIsoCode({
|
||||
isoCode: model.unique,
|
||||
@@ -132,8 +132,8 @@ export class UmbLanguageServerDataSource implements UmbDetailDataSource<UmbLangu
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -230,7 +230,7 @@ export class UmbMediaTypeServerDataSource implements UmbDetailDataSource<UmbMedi
|
||||
}),
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
MediaTypeResource.putMediaTypeById({
|
||||
id: model.unique,
|
||||
@@ -238,8 +238,8 @@ export class UmbMediaTypeServerDataSource implements UmbDetailDataSource<UmbMedi
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -145,7 +145,7 @@ export class UmbMediaServerDataSource implements UmbDetailDataSource<UmbMediaDet
|
||||
variants: model.variants,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
MediaResource.putMediaById({
|
||||
id: model.unique,
|
||||
@@ -153,8 +153,8 @@ export class UmbMediaServerDataSource implements UmbDetailDataSource<UmbMediaDet
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -4,12 +4,8 @@ import {
|
||||
UmbServerFilePathUniqueSerializer,
|
||||
appendFileExtensionIfNeeded,
|
||||
} from '@umbraco-cms/backoffice/server-file-system';
|
||||
import type {
|
||||
CreatePartialViewRequestModel,
|
||||
UpdatePartialViewRequestModel} from '@umbraco-cms/backoffice/backend-api';
|
||||
import {
|
||||
PartialViewResource
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { CreatePartialViewRequestModel, UpdatePartialViewRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { PartialViewResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbDetailDataSource } from '@umbraco-cms/backoffice/repository';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -103,7 +99,7 @@ export class UmbPartialViewDetailServerDataSource implements UmbDetailDataSource
|
||||
content: model.content,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
PartialViewResource.putPartialViewByPath({
|
||||
path: encodeURIComponent(path),
|
||||
@@ -111,8 +107,8 @@ export class UmbPartialViewDetailServerDataSource implements UmbDetailDataSource
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -4,12 +4,8 @@ import {
|
||||
UmbServerFilePathUniqueSerializer,
|
||||
appendFileExtensionIfNeeded,
|
||||
} from '@umbraco-cms/backoffice/server-file-system';
|
||||
import type {
|
||||
CreateScriptRequestModel,
|
||||
UpdateScriptRequestModel} from '@umbraco-cms/backoffice/backend-api';
|
||||
import {
|
||||
ScriptResource
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { CreateScriptRequestModel, UpdateScriptRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { ScriptResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbDetailDataSource } from '@umbraco-cms/backoffice/repository';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -102,7 +98,7 @@ export class UmbScriptDetailServerDataSource implements UmbDetailDataSource<UmbS
|
||||
content: model.content,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
ScriptResource.putScriptByPath({
|
||||
path: encodeURIComponent(path),
|
||||
@@ -110,8 +106,8 @@ export class UmbScriptDetailServerDataSource implements UmbDetailDataSource<UmbS
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -4,12 +4,8 @@ import {
|
||||
UmbServerFilePathUniqueSerializer,
|
||||
appendFileExtensionIfNeeded,
|
||||
} from '@umbraco-cms/backoffice/server-file-system';
|
||||
import type {
|
||||
CreateStylesheetRequestModel,
|
||||
UpdateStylesheetRequestModel} from '@umbraco-cms/backoffice/backend-api';
|
||||
import {
|
||||
StylesheetResource
|
||||
} from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { CreateStylesheetRequestModel, UpdateStylesheetRequestModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { StylesheetResource } from '@umbraco-cms/backoffice/backend-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbDetailDataSource } from '@umbraco-cms/backoffice/repository';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
|
||||
@@ -102,7 +98,7 @@ export class UmbStylesheetDetailServerDataSource implements UmbDetailDataSource<
|
||||
content: model.content,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
StylesheetResource.putStylesheetByPath({
|
||||
path: encodeURIComponent(path),
|
||||
@@ -110,8 +106,8 @@ export class UmbStylesheetDetailServerDataSource implements UmbDetailDataSource<
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -121,7 +121,7 @@ export class UmbTemplateServerDataSource implements UmbDetailDataSource<UmbTempl
|
||||
alias: model.alias,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
TemplateResource.putTemplateById({
|
||||
id: model.unique,
|
||||
@@ -129,8 +129,8 @@ export class UmbTemplateServerDataSource implements UmbDetailDataSource<UmbTempl
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -146,7 +146,7 @@ export class UmbUserGroupServerDataSource implements UmbDetailDataSource<UmbUser
|
||||
permissions: model.permissions,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
UserGroupResource.putUserGroupById({
|
||||
id: model.unique,
|
||||
@@ -154,8 +154,8 @@ export class UmbUserGroupServerDataSource implements UmbDetailDataSource<UmbUser
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
@@ -146,7 +146,7 @@ export class UmbUserServerDataSource implements UmbDetailDataSource<UmbUserDetai
|
||||
userName: model.userName,
|
||||
};
|
||||
|
||||
const { data, error } = await tryExecuteAndNotify(
|
||||
const { error } = await tryExecuteAndNotify(
|
||||
this.#host,
|
||||
UserResource.putUserById({
|
||||
id: model.unique,
|
||||
@@ -154,8 +154,8 @@ export class UmbUserServerDataSource implements UmbDetailDataSource<UmbUserDetai
|
||||
}),
|
||||
);
|
||||
|
||||
if (data) {
|
||||
return this.read(data);
|
||||
if (!error) {
|
||||
return this.read(model.unique);
|
||||
}
|
||||
|
||||
return { error };
|
||||
|
||||
Reference in New Issue
Block a user