@tager/admin-blog 0.3.24 → 0.3.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/index.esm.js +546 -278
  2. package/dist/index.umd.js +545 -275
  3. package/package.json +7 -5
  4. package/src/constants/scopes.ts +11 -0
  5. package/src/dev.ts +11 -42
  6. package/src/hooks/index.ts +3 -0
  7. package/src/hooks/useModuleConfig.ts +2 -2
  8. package/src/hooks/useStore.ts +8 -0
  9. package/src/hooks/useUserPermission.ts +16 -0
  10. package/src/hooks/useUserProfile.ts +13 -0
  11. package/src/locales/en.ts +10 -0
  12. package/src/locales/ru.ts +10 -0
  13. package/src/router/index.ts +39 -0
  14. package/src/services/requests.ts +17 -1
  15. package/src/store/index.ts +21 -0
  16. package/src/store/user.ts +109 -0
  17. package/src/typings/common.ts +1 -0
  18. package/src/typings/model.ts +23 -0
  19. package/src/utils/common.ts +23 -0
  20. package/src/views/App.vue +10 -2
  21. package/src/views/Categories/CategoryForm/CategoryForm.helpers.ts +19 -4
  22. package/src/views/Categories/CategoryForm/CategoryForm.vue +139 -66
  23. package/src/views/Categories/CategoryList/CategoryList.helpers.ts +30 -28
  24. package/src/views/Categories/CategoryList/CategoryList.vue +26 -11
  25. package/src/views/Categories/CategoryList/hooks/useAdvancedSearch.ts +1 -1
  26. package/src/views/Home.vue +1 -1
  27. package/src/views/Posts/PostForm/PostForm.helpers.ts +2 -5
  28. package/src/views/Posts/PostForm/PostForm.vue +4 -6
  29. package/src/views/Posts/PostList/PostList.helpers.ts +2 -7
  30. package/src/views/Posts/PostList/PostList.vue +84 -24
  31. package/src/views/Posts/PostList/hooks/useAdvancedSearch.ts +6 -5
  32. package/dist/constants/menu.d.ts +0 -5
  33. package/dist/constants/paths.d.ts +0 -14
  34. package/dist/constants/routes.d.ts +0 -5
  35. package/dist/dev.d.ts +0 -3
  36. package/dist/hooks/index.d.ts +0 -3
  37. package/dist/hooks/useBlogCategoryList.d.ts +0 -6
  38. package/dist/hooks/useBlogPostList.d.ts +0 -6
  39. package/dist/hooks/useModuleConfig.d.ts +0 -6
  40. package/dist/locales/en.d.ts +0 -66
  41. package/dist/locales/ru.d.ts +0 -3
  42. package/dist/main.d.ts +0 -4
  43. package/dist/services/requests.d.ts +0 -67
  44. package/dist/typings/model.d.ts +0 -73
  45. package/dist/views/Categories/CategoryForm/CategoryForm.helpers.d.ts +0 -16
  46. package/dist/views/Categories/CategoryForm/CategoryForm.vue.d.ts +0 -86
  47. package/dist/views/Categories/CategoryForm/index.d.ts +0 -1
  48. package/dist/views/Categories/CategoryList/CategoryList.helpers.d.ts +0 -7
  49. package/dist/views/Categories/CategoryList/CategoryList.vue.d.ts +0 -57
  50. package/dist/views/Categories/CategoryList/hooks/index.d.ts +0 -1
  51. package/dist/views/Categories/CategoryList/hooks/useAdvancedSearch.d.ts +0 -16
  52. package/dist/views/Categories/CategoryList/index.d.ts +0 -1
  53. package/dist/views/Posts/PostForm/PostForm.helpers.d.ts +0 -27
  54. package/dist/views/Posts/PostForm/PostForm.vue.d.ts +0 -9380
  55. package/dist/views/Posts/PostForm/components/TabList/TabList.types.d.ts +0 -5
  56. package/dist/views/Posts/PostForm/components/TabList/index.d.ts +0 -2
  57. package/dist/views/Posts/PostForm/index.d.ts +0 -1
  58. package/dist/views/Posts/PostList/PostList.helpers.d.ts +0 -6
  59. package/dist/views/Posts/PostList/PostList.vue.d.ts +0 -63
  60. package/dist/views/Posts/PostList/hooks/index.d.ts +0 -1
  61. package/dist/views/Posts/PostList/hooks/useAdvancedSearch.d.ts +0 -22
  62. package/dist/views/Posts/PostList/index.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tager/admin-blog",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -21,15 +21,16 @@
21
21
  "dependencies": {
22
22
  "lodash.isequal": "^4.5.0",
23
23
  "lodash.pick": "^4.4.0",
24
- "path-to-regexp": "^6.1.0"
24
+ "path-to-regexp": "^6.1.0",
25
+ "vuex": "^3.6.2"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@rollup/plugin-commonjs": "^15.0.0",
28
29
  "@rollup/plugin-node-resolve": "^9.0.0",
29
30
  "@tager/admin-dynamic-field": "^0.1.18",
30
31
  "@tager/admin-layout": "^0.5.3",
31
- "@tager/admin-services": "^0.2.25",
32
- "@tager/admin-ui": "^0.8.84",
32
+ "@tager/admin-services": "^0.2.26",
33
+ "@tager/admin-ui": "^0.8.85",
33
34
  "@types/lodash.isequal": "^4.5.5",
34
35
  "@types/lodash.pick": "^4.4.6",
35
36
  "@types/node": "12.x",
@@ -39,6 +40,7 @@
39
40
  "@vue/cli-plugin-eslint": "~4.5.6",
40
41
  "@vue/cli-plugin-router": "~4.5.6",
41
42
  "@vue/cli-plugin-typescript": "~4.5.6",
43
+ "@vue/cli-plugin-vuex": "^4.5.14",
42
44
  "@vue/cli-service": "~4.5.6",
43
45
  "@vue/composition-api": "^1.0.0-beta.14",
44
46
  "@vue/eslint-config-prettier": "^6.0.0",
@@ -54,7 +56,7 @@
54
56
  "rollup-plugin-typescript2": "^0.27.2",
55
57
  "rollup-plugin-vue": "^5.1.9",
56
58
  "sass-loader": "^10.0.2",
57
- "typescript": "~3.9.6",
59
+ "typescript": "~3.9.10",
58
60
  "vue": "2.6.x",
59
61
  "vue-router": "^3.5.1",
60
62
  "vue-template-compiler": "^2.6.11"
@@ -0,0 +1,11 @@
1
+ export const Scope = {
2
+ All: '*',
3
+ OrdersCreate: 'orders.create',
4
+ OrdersView: 'orders.view',
5
+ OrdersDelete: 'orders.delete',
6
+ RbacViewRoles: 'rbac.view-roles',
7
+ RbacEditRoles: 'rbac.edit-roles',
8
+ AdministratorsView: 'administrators.view',
9
+ AdministratorsEdit: 'administrators.edit',
10
+ AdministratorsDelete: 'administrators.delete',
11
+ } as const;
package/src/dev.ts CHANGED
@@ -1,67 +1,36 @@
1
1
  import Vue, { CreateElement } from 'vue';
2
2
  import VueCompositionApi, { createApp } from '@vue/composition-api';
3
+ import Vuex from 'vuex';
3
4
 
4
5
  import { configStore, i18n } from '@tager/admin-services';
5
6
  import { AdminUiPlugin } from '@tager/admin-ui';
6
- import {
7
- AdminLayoutPlugin,
8
- createRouter,
9
- CustomRoute,
10
- CustomRouteConfig,
11
- } from '@tager/admin-layout';
7
+ import { AdminLayoutPlugin } from '@tager/admin-layout';
12
8
 
13
9
  import '@tager/admin-ui/dist/admin-ui.css';
14
10
 
15
- import {
16
- BLOG_CATEGORY_FORM_ROUTE,
17
- BLOG_CATEGORY_LIST_ROUTE,
18
- BLOG_POST_FORM_ROUTE,
19
- BLOG_POST_LIST_ROUTE,
20
- } from './constants/routes';
21
- import config from './config/config.json';
22
- import App from './views/App.vue';
23
- import Home from './views/Home.vue';
24
- import EN from './locales/en';
25
- import RU from './locales/ru';
11
+ import config from '@/config/config.json';
12
+ import App from '@/views/App.vue';
13
+ import EN from '@/locales/en';
14
+ import RU from '@/locales/ru';
15
+ import router from '@/router';
16
+ import store from '@/store';
26
17
 
27
18
  configStore.setConfig(config);
28
19
 
29
- export const HOME_ROUTE: CustomRouteConfig = {
30
- path: '/',
31
- component: Home,
32
- name: 'Home',
33
- meta: {
34
- getBreadcrumbs: (route: CustomRoute) => [
35
- { url: '/', text: route.name ?? '' },
36
- ],
37
- },
38
- };
39
-
40
- const router = createRouter(
41
- {
42
- routes: [
43
- HOME_ROUTE,
44
- BLOG_POST_LIST_ROUTE,
45
- BLOG_POST_FORM_ROUTE,
46
- BLOG_CATEGORY_LIST_ROUTE,
47
- BLOG_CATEGORY_FORM_ROUTE,
48
- ],
49
- },
50
- { useTitleSync: false }
51
- );
20
+ Vue.use(VueCompositionApi);
52
21
 
53
22
  i18n.addTranslations('en', 'blog', EN);
54
23
  i18n.addTranslations('ru', 'blog', RU);
55
24
 
56
25
  i18n.init({ debug: false }).then(() => {
57
- Vue.use(VueCompositionApi);
58
-
59
26
  const app = createApp({
60
27
  router,
61
28
  render: (h: CreateElement) => h(App),
29
+ store,
62
30
  });
63
31
 
64
32
  app.use(i18n.getPlugin());
33
+ app.use(Vuex);
65
34
  app.use(AdminUiPlugin);
66
35
  app.use(AdminLayoutPlugin);
67
36
 
@@ -1,3 +1,6 @@
1
1
  export { useModuleConfig } from './useModuleConfig';
2
2
  export { useBlogPostList } from './useBlogPostList';
3
3
  export { useBlogCategoryList } from './useBlogCategoryList';
4
+ export { useStore } from './useStore';
5
+ export { useUserProfile } from './useUserProfile';
6
+ export { useUserPermission } from './useUserPermission';
@@ -2,8 +2,8 @@ import { onMounted, SetupContext } from '@vue/composition-api';
2
2
 
3
3
  import { Nullable, ResourceRef, useResource } from '@tager/admin-services';
4
4
 
5
- import { ModuleConfig } from '../typings/model';
6
- import { getBlogModuleConfig } from '../services/requests';
5
+ import { ModuleConfig } from '@/typings/model';
6
+ import { getBlogModuleConfig } from '@/services/requests';
7
7
 
8
8
  export function useModuleConfig(params: {
9
9
  context: SetupContext;
@@ -0,0 +1,8 @@
1
+ import { Store } from 'vuex';
2
+ import { SetupContext } from '@vue/composition-api';
3
+
4
+ import { RootState } from '@/store';
5
+
6
+ export function useStore(context: SetupContext): Store<RootState> {
7
+ return context.root.$store;
8
+ }
@@ -0,0 +1,16 @@
1
+ import { computed, ComputedRef, SetupContext } from '@vue/composition-api';
2
+
3
+ import { ScopeType } from '@/typings/model';
4
+ import { useStore } from '@/hooks/useStore';
5
+ import { userNamespace } from '@/utils/common';
6
+
7
+ export function useUserPermission(
8
+ context: SetupContext,
9
+ scope: ScopeType
10
+ ): ComputedRef<boolean> {
11
+ const store = useStore(context);
12
+
13
+ return computed<boolean>(() => {
14
+ return store.getters[userNamespace('userHasPermission')](scope);
15
+ });
16
+ }
@@ -0,0 +1,13 @@
1
+ import { computed, ComputedRef, SetupContext } from '@vue/composition-api';
2
+
3
+ import { UserModel } from '@/typings/model';
4
+ import { useStore } from '@/hooks/useStore';
5
+ import { userNamespace } from '@/utils/common';
6
+
7
+ export function useUserProfile(context: SetupContext): ComputedRef<UserModel> {
8
+ const store = useStore(context);
9
+
10
+ return computed<UserModel>(() => {
11
+ return store.getters[userNamespace('userProfile')];
12
+ });
13
+ }
package/src/locales/en.ts CHANGED
@@ -62,6 +62,16 @@ const EN = {
62
62
  blogCategoryWasSuccessfullyUpdated: 'Blog category was successfully updated',
63
63
  blogCategoryCreationWasFailed: 'Blog category creation was failed',
64
64
  blogCategoryUpdateWasFailed: 'Blog category update was failed',
65
+
66
+ clone: 'Clone',
67
+ cloneConfirm: 'Are you sure you want to clone the page?',
68
+ cloneSuccess: 'Page have copied successfully',
69
+ cloneFailure: 'Page copy failure',
70
+
71
+ tabs: {
72
+ common: 'Common',
73
+ seo: 'SEO',
74
+ },
65
75
  };
66
76
 
67
77
  export default EN;
package/src/locales/ru.ts CHANGED
@@ -64,6 +64,16 @@ const RU: typeof EN = {
64
64
  blogCategoryWasSuccessfullyUpdated: 'Категория блога успешно обновлена',
65
65
  blogCategoryCreationWasFailed: 'Не удалось создать категорию блога',
66
66
  blogCategoryUpdateWasFailed: 'Не удалось обновить категорию блога',
67
+
68
+ clone: 'Клонировать',
69
+ cloneConfirm: 'Вы уверены, что хотите создать копию страницы?',
70
+ cloneSuccess: 'Копия страницы успешно создана',
71
+ cloneFailure: 'Ошибка копирования страницы',
72
+
73
+ tabs: {
74
+ common: 'Общие',
75
+ seo: 'SEO',
76
+ },
67
77
  };
68
78
 
69
79
  export default RU;
@@ -0,0 +1,39 @@
1
+ import {
2
+ createRouter,
3
+ CustomRoute,
4
+ CustomRouteConfig,
5
+ } from '@tager/admin-layout';
6
+
7
+ import {
8
+ BLOG_CATEGORY_FORM_ROUTE,
9
+ BLOG_CATEGORY_LIST_ROUTE,
10
+ BLOG_POST_FORM_ROUTE,
11
+ BLOG_POST_LIST_ROUTE,
12
+ } from '@/constants/routes';
13
+ import Home from '@/views/Home.vue';
14
+
15
+ export const HOME_ROUTE: CustomRouteConfig = {
16
+ path: '/',
17
+ component: Home,
18
+ name: 'Home',
19
+ meta: {
20
+ getBreadcrumbs: (route: CustomRoute) => [
21
+ { url: '/', text: route.name ?? '' },
22
+ ],
23
+ },
24
+ };
25
+
26
+ const router = createRouter(
27
+ {
28
+ routes: [
29
+ HOME_ROUTE,
30
+ BLOG_POST_LIST_ROUTE,
31
+ BLOG_POST_FORM_ROUTE,
32
+ BLOG_CATEGORY_LIST_ROUTE,
33
+ BLOG_CATEGORY_FORM_ROUTE,
34
+ ],
35
+ },
36
+ { useTitleSync: false }
37
+ );
38
+
39
+ export default router;
@@ -1,7 +1,17 @@
1
1
  import { request, Nullable, ResponseBody } from '@tager/admin-services';
2
2
  import { FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
3
3
 
4
- import { Category, ModuleConfig, PostShort, PostFull } from '../typings/model';
4
+ import {
5
+ Category,
6
+ ModuleConfig,
7
+ PostShort,
8
+ PostFull,
9
+ UserModel,
10
+ } from '@/typings/model';
11
+
12
+ export function getUserProfile(): Promise<ResponseBody<UserModel>> {
13
+ return request.get({ path: '/admin/self' });
14
+ }
5
15
 
6
16
  /** Blog Posts */
7
17
 
@@ -23,6 +33,12 @@ export function getBlogPost(
23
33
  return request.get({ path: `/admin/blog/posts/${postId}` });
24
34
  }
25
35
 
36
+ export function clonePost(
37
+ postId: number | string
38
+ ): Promise<ResponseBody<PostFull>> {
39
+ return request.post({ path: `/admin/blog/posts/${postId}/clone` });
40
+ }
41
+
26
42
  export interface PostCreationPayload {
27
43
  title: string;
28
44
  urlAlias: string;
@@ -0,0 +1,21 @@
1
+ import Vue from 'vue';
2
+ import Vuex from 'vuex';
3
+
4
+ import userModule, {
5
+ USER_MODULE_NAMESPACE,
6
+ UserModuleStateModel,
7
+ } from '@/store/user';
8
+
9
+ Vue.use(Vuex);
10
+
11
+ export interface RootState {
12
+ user: UserModuleStateModel;
13
+ }
14
+
15
+ const store = new Vuex.Store({
16
+ modules: {
17
+ [USER_MODULE_NAMESPACE]: userModule,
18
+ },
19
+ });
20
+
21
+ export default store;
@@ -0,0 +1,109 @@
1
+ import { GetterTree, Module } from 'vuex';
2
+
3
+ import { FETCH_STATUSES, FetchStatus } from '@tager/admin-services';
4
+
5
+ import { ScopeType, UserModel } from '@/typings/model';
6
+ import { getUserProfile } from '@/services/requests';
7
+ import { RootState } from '@/store';
8
+ import { Scope } from '@/constants/scopes';
9
+
10
+ export interface UserModuleStateModel {
11
+ profile: UserModel | null;
12
+ status: FetchStatus;
13
+ }
14
+
15
+ export const USER_MODULE_NAMESPACE = 'user';
16
+
17
+ const USER_MUTATION_TYPES = {
18
+ PROFILE_REQUEST_STARTED: 'profileRequestStarted',
19
+ PROFILE_REQUEST_FULFILLED: 'profileRequestFulfilled',
20
+ PROFILE_REQUEST_REJECTED: 'profileRequestRejected',
21
+ };
22
+
23
+ export const USER_ACTION_TYPES = {
24
+ FETCH_USER_PROFILE: 'fetchUserProfile',
25
+ } as const;
26
+
27
+ type ReturnValueMapType<
28
+ T extends { [key: string]: (...args: any[]) => any }
29
+ > = { [key in keyof T]: ReturnType<T[key]> };
30
+
31
+ interface UserGettersType extends GetterTree<UserModuleStateModel, RootState> {
32
+ userScopes: (state: UserModuleStateModel) => Array<ScopeType>;
33
+ userHasPermission: (
34
+ state: UserModuleStateModel,
35
+ getters: ReturnValueMapType<UserGettersType>
36
+ ) => (scope: ScopeType) => boolean;
37
+ }
38
+
39
+ const userGetters: UserGettersType = {
40
+ userProfile(state) {
41
+ return state.profile;
42
+ },
43
+ userScopes(state) {
44
+ const roles = state.profile ? state.profile.roles : [];
45
+ const scopes: Array<ScopeType> = [];
46
+
47
+ roles.forEach((role) => {
48
+ scopes.push(...role.scopes);
49
+ });
50
+
51
+ return scopes;
52
+ },
53
+ userHasPermission: (state, getters) => (scope: ScopeType) => {
54
+ const scopes = getters.userScopes;
55
+
56
+ if (scopes.includes(Scope.All)) return true;
57
+
58
+ return scopes.includes(scope);
59
+ },
60
+ };
61
+
62
+ const userModule: Module<UserModuleStateModel, RootState> = {
63
+ namespaced: true,
64
+ state: {
65
+ profile: null,
66
+ status: FETCH_STATUSES.IDLE,
67
+ },
68
+ mutations: {
69
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED](state) {
70
+ if (state.status === FETCH_STATUSES.IDLE) {
71
+ state.status = FETCH_STATUSES.LOADING;
72
+ }
73
+ },
74
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED](state, user: UserModel) {
75
+ if (state.status === FETCH_STATUSES.LOADING) {
76
+ state.status = FETCH_STATUSES.SUCCESS;
77
+ state.profile = user;
78
+ }
79
+ },
80
+ [USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED](state) {
81
+ if (state.status === FETCH_STATUSES.LOADING) {
82
+ state.status = FETCH_STATUSES.FAILURE;
83
+ state.profile = null;
84
+ }
85
+ },
86
+ },
87
+ actions: {
88
+ [USER_ACTION_TYPES.FETCH_USER_PROFILE](store) {
89
+ if (store.state.status !== FETCH_STATUSES.IDLE) return;
90
+
91
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_STARTED);
92
+
93
+ getUserProfile()
94
+ .then((response) => {
95
+ store.commit(
96
+ USER_MUTATION_TYPES.PROFILE_REQUEST_FULFILLED,
97
+ response.data
98
+ );
99
+ })
100
+ .catch((error) => {
101
+ console.error(error);
102
+ store.commit(USER_MUTATION_TYPES.PROFILE_REQUEST_REJECTED);
103
+ });
104
+ },
105
+ },
106
+ getters: userGetters,
107
+ };
108
+
109
+ export default userModule;
@@ -0,0 +1 @@
1
+ export type Values<T> = T[keyof T];
@@ -6,9 +6,30 @@ import {
6
6
  } from '@tager/admin-dynamic-field';
7
7
  import { ShortCodeItemType } from '@tager/admin-ui';
8
8
 
9
+ import { Values } from '@/typings/common';
10
+ import { Scope } from '@/constants/scopes';
11
+
12
+ export type ScopeType = Values<typeof Scope>;
13
+
14
+ export interface RoleModel {
15
+ readonly id: number;
16
+ readonly name: string;
17
+ readonly scopes: Array<ScopeType>;
18
+ }
19
+
20
+ export interface UserModel {
21
+ readonly id: number;
22
+ readonly name: string;
23
+ readonly email: string;
24
+ readonly roles: Array<RoleModel>;
25
+ }
26
+
9
27
  export interface SeoInfo {
10
28
  readonly pageTitle: Nullable<string>;
11
29
  readonly pageDescription: Nullable<string>;
30
+ readonly pageKeywords: Nullable<string>;
31
+ readonly openGraphTitle: Nullable<string>;
32
+ readonly openGraphDescription: Nullable<string>;
12
33
  readonly openGraphImage: Nullable<FileType>;
13
34
  }
14
35
 
@@ -21,6 +42,8 @@ export interface Category extends SeoInfo {
21
42
  readonly urlTemplate: string;
22
43
  readonly urlAlias: string;
23
44
  readonly postsCount: string;
45
+ readonly parent: Nullable<Pick<Category, 'id' | 'name'>>;
46
+ readonly depth: number;
24
47
  }
25
48
 
26
49
  export interface PostShort {
@@ -0,0 +1,23 @@
1
+ import { USER_MODULE_NAMESPACE } from '@/store/user';
2
+
3
+ export function namespace(namespace: string, name: string): string {
4
+ return `${namespace}/${name}`;
5
+ }
6
+
7
+ export function userNamespace(name: string): string {
8
+ return namespace(USER_MODULE_NAMESPACE, name);
9
+ }
10
+
11
+ export function generateNumberArray(length: number): Array<number> {
12
+ return Array.from({ length }, (_, index) => index);
13
+ }
14
+
15
+ export function getNameWithDepth(name: string, depth: number): string {
16
+ return (
17
+ generateNumberArray(depth)
18
+ .map(() => '—')
19
+ .join(' ') +
20
+ ' ' +
21
+ name
22
+ );
23
+ }
package/src/views/App.vue CHANGED
@@ -5,15 +5,23 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts">
8
- import { defineComponent, SetupContext } from '@vue/composition-api';
8
+ import { defineComponent, onMounted, SetupContext } from '@vue/composition-api';
9
9
 
10
- import { getBlogMenuItem } from '../constants/menu';
10
+ import { getBlogMenuItem } from '@/constants/menu';
11
+ import { useStore } from '@/hooks';
12
+ import { USER_ACTION_TYPES } from '@/store/user';
13
+ import { userNamespace } from '@/utils/common';
11
14
 
12
15
  export default defineComponent({
13
16
  name: 'App',
14
17
  setup(props, context: SetupContext) {
18
+ const store = useStore(context);
15
19
  const blogMenuItem = getBlogMenuItem({ t: context.root.$t });
16
20
 
21
+ onMounted(() => {
22
+ store.dispatch(userNamespace(USER_ACTION_TYPES.FETCH_USER_PROFILE));
23
+ });
24
+
17
25
  return {
18
26
  sidebarMenuList: [blogMenuItem],
19
27
  };
@@ -1,18 +1,23 @@
1
1
  import { createId, Nullable } from '@tager/admin-services';
2
2
  import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
3
3
 
4
- import { Category } from '../../../typings/model';
4
+ import { Category } from '@/typings/model';
5
5
  import {
6
6
  BlogCategoryCreationPayload,
7
7
  BlogCategoryUpdatePayload,
8
- } from '../../../services/requests';
8
+ } from '@/services/requests';
9
9
 
10
10
  export type CategoryFormValues = {
11
11
  name: string;
12
12
  isDefault: boolean;
13
- pageTitle: string;
14
- pageDescription: string;
13
+
14
+ pageTitle: Nullable<string>;
15
+ pageDescription: Nullable<string>;
16
+ pageKeywords: Nullable<string>;
17
+ openGraphTitle: Nullable<string>;
18
+ openGraphDescription: Nullable<string>;
15
19
  openGraphImage: Nullable<SingleFileInputValueType>;
20
+
16
21
  urlAlias: string;
17
22
  language: Nullable<OptionType>;
18
23
  };
@@ -29,9 +34,14 @@ export function convertCategoryToFormValues(
29
34
  return {
30
35
  name: '',
31
36
  isDefault: false,
37
+
32
38
  pageTitle: '',
33
39
  pageDescription: '',
40
+ openGraphTitle: '',
41
+ openGraphDescription: '',
42
+ pageKeywords: '',
34
43
  openGraphImage: null,
44
+
35
45
  urlAlias: '',
36
46
  language: currentLangOption ?? null,
37
47
  };
@@ -39,11 +49,16 @@ export function convertCategoryToFormValues(
39
49
  return {
40
50
  name: category.name,
41
51
  isDefault: category.isDefault,
52
+
42
53
  pageTitle: category.pageTitle ?? '',
43
54
  pageDescription: category.pageDescription ?? '',
55
+ pageKeywords: category.pageKeywords ?? '',
56
+ openGraphTitle: category.openGraphTitle ?? '',
57
+ openGraphDescription: category.openGraphDescription ?? '',
44
58
  openGraphImage: category.openGraphImage
45
59
  ? { id: createId(), file: category.openGraphImage }
46
60
  : null,
61
+
47
62
  urlAlias: category.urlAlias,
48
63
  language: currentLangOption ?? null,
49
64
  };