MOBILE-4470 blog: Make PUBLISH_STATE const match type name
parent
8b2b130e14
commit
8544599692
|
@ -21,7 +21,6 @@ import {
|
||||||
AddonBlogPost,
|
AddonBlogPost,
|
||||||
AddonBlogProvider,
|
AddonBlogProvider,
|
||||||
AddonBlogPublishState,
|
AddonBlogPublishState,
|
||||||
ADDON_BLOG_PUBLISH_STATE,
|
|
||||||
} from '@addons/blog/services/blog';
|
} from '@addons/blog/services/blog';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
|
@ -55,12 +54,12 @@ import { CoreEvents } from '@singletons/events';
|
||||||
})
|
})
|
||||||
export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||||
|
|
||||||
publishState = ADDON_BLOG_PUBLISH_STATE;
|
publishState = AddonBlogPublishState;
|
||||||
form = new FormGroup({
|
form = new FormGroup({
|
||||||
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
subject: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||||
summary: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
summary: new FormControl<string>('', { nonNullable: true, validators: [Validators.required] }),
|
||||||
publishState: new FormControl<AddonBlogPublishState>(
|
publishState: new FormControl<AddonBlogPublishState>(
|
||||||
ADDON_BLOG_PUBLISH_STATE.site,
|
AddonBlogPublishState.site,
|
||||||
{ nonNullable: true, validators: [Validators.required] },
|
{ nonNullable: true, validators: [Validators.required] },
|
||||||
),
|
),
|
||||||
associateWithCourse: new FormControl<boolean>(false, { nonNullable: true, validators: [Validators.required] }),
|
associateWithCourse: new FormControl<boolean>(false, { nonNullable: true, validators: [Validators.required] }),
|
||||||
|
@ -110,7 +109,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||||
|
|
||||||
return form.subject.value !== '' ||
|
return form.subject.value !== '' ||
|
||||||
form.summary.value !== '' ||
|
form.summary.value !== '' ||
|
||||||
form.publishState.value !== ADDON_BLOG_PUBLISH_STATE.site ||
|
form.publishState.value !== AddonBlogPublishState.site ||
|
||||||
CoreFileUploader.areFileListDifferent(this.files, this.initialFiles);
|
CoreFileUploader.areFileListDifferent(this.files, this.initialFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +164,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
subject: this.entry?.subject ?? '',
|
subject: this.entry?.subject ?? '',
|
||||||
summary: this.entry?.summary ?? '',
|
summary: this.entry?.summary ?? '',
|
||||||
publishState: this.entry?.publishstate ?? ADDON_BLOG_PUBLISH_STATE.site,
|
publishState: this.entry?.publishstate ?? AddonBlogPublishState.site,
|
||||||
associateWithCourse: this.form.controls.associateWithCourse.value,
|
associateWithCourse: this.form.controls.associateWithCourse.value,
|
||||||
associateWithModule: this.form.controls.associateWithModule.value,
|
associateWithModule: this.form.controls.associateWithModule.value,
|
||||||
});
|
});
|
||||||
|
|
|
@ -335,6 +335,6 @@ export type AddonBlogGetEntriesOptions = CoreSitesCommonWSOptions & {
|
||||||
page?: number;
|
page?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ADDON_BLOG_PUBLISH_STATE = { draft: 'draft', site: 'site', public: 'public' } as const;
|
export const AddonBlogPublishState = { draft: 'draft', site: 'site', public: 'public' } as const;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
export type AddonBlogPublishState = typeof ADDON_BLOG_PUBLISH_STATE[keyof typeof ADDON_BLOG_PUBLISH_STATE];
|
export type AddonBlogPublishState = typeof AddonBlogPublishState[keyof typeof AddonBlogPublishState];
|
||||||
|
|
Loading…
Reference in New Issue