summaryrefslogtreecommitdiff
path: root/lib/admin/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/admin/src')
-rw-r--r--lib/admin/src/channels/channels.ts5
-rw-r--r--lib/admin/src/channels/computedChannels.ts2
-rw-r--r--lib/admin/src/content/computedContent.ts2
-rw-r--r--lib/admin/src/content/useContent.ts6
-rw-r--r--lib/admin/src/feedProperties/index.ts2
-rw-r--r--lib/admin/src/helpers.ts2
-rw-r--r--lib/admin/src/index.ts27
-rw-r--r--lib/admin/src/ordering/index.ts2
-rw-r--r--lib/admin/src/posts/computedPosts.ts2
-rw-r--r--lib/admin/src/posts/usePost.ts6
-rw-r--r--lib/admin/src/types.ts2
11 files changed, 34 insertions, 24 deletions
diff --git a/lib/admin/src/channels/channels.ts b/lib/admin/src/channels/channels.ts
index 3100963..3efb6b7 100644
--- a/lib/admin/src/channels/channels.ts
+++ b/lib/admin/src/channels/channels.ts
@@ -13,15 +13,14 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { useAxios } from '@vnuge/vnlib.browser';
-import { isEqual, toSafeInteger } from 'lodash';
+import { isEqual, toSafeInteger } from 'lodash-es';
import { BlogChannel, ChannelFeed, ChannelApi, BlogAdminContext } from '../types.js'
/**
* Gets the channel helper api to manage content channels
*/
export const useChannels = (context: BlogAdminContext): ChannelApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const getUrl = (): string => context.getChannelUrl();
diff --git a/lib/admin/src/channels/computedChannels.ts b/lib/admin/src/channels/computedChannels.ts
index 2fb64f2..dbf7cd5 100644
--- a/lib/admin/src/channels/computedChannels.ts
+++ b/lib/admin/src/channels/computedChannels.ts
@@ -15,7 +15,7 @@
import { apiCall } from '@vnuge/vnlib.browser';
import { Ref, computed, ref, watch } from 'vue'
-import { find, isEmpty, isEqual } from 'lodash';
+import { find, isEmpty, isEqual } from 'lodash-es';
import { BlogChannel, ChannelApi, ComputedBlogApi, BlogAdminContext } from '../types.js'
import { useChannels } from './channels.js';
diff --git a/lib/admin/src/content/computedContent.ts b/lib/admin/src/content/computedContent.ts
index c4ca575..65c1537 100644
--- a/lib/admin/src/content/computedContent.ts
+++ b/lib/admin/src/content/computedContent.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { Ref, computed } from "vue";
-import { find, filter, includes, isEqual, isNil, toLower } from "lodash";
+import { find, filter, includes, isEqual, isNil, toLower } from 'lodash-es';
import { apiCall } from "@vnuge/vnlib.browser"
import { ContentMeta, BlogEntity, ContentApi, ComputedBlogApi, BlogAdminContext } from "../types.js";
import { watchAndCompute } from "../helpers.js";
diff --git a/lib/admin/src/content/useContent.ts b/lib/admin/src/content/useContent.ts
index 1493565..d23177c 100644
--- a/lib/admin/src/content/useContent.ts
+++ b/lib/admin/src/content/useContent.ts
@@ -13,8 +13,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { includes, isEmpty } from "lodash";
-import { WebMessage, useAxios } from "@vnuge/vnlib.browser"
+import { includes, isEmpty } from 'lodash-es';
+import { WebMessage } from "@vnuge/vnlib.browser"
import { PostMeta, ContentMeta, ContentApi, BlogEntity, BlogAdminContext } from "../types.js";
@@ -25,7 +25,7 @@ import { PostMeta, ContentMeta, ContentApi, BlogEntity, BlogAdminContext } from
* @returns A content api object
*/
export const useContent = (context : BlogAdminContext): ContentApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const { channel } = context.getQuery();
diff --git a/lib/admin/src/feedProperties/index.ts b/lib/admin/src/feedProperties/index.ts
index 733acde..58ee179 100644
--- a/lib/admin/src/feedProperties/index.ts
+++ b/lib/admin/src/feedProperties/index.ts
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { cloneDeep, filter, forEach, isEmpty, join, map } from 'lodash';
+import { cloneDeep, filter, forEach, isEmpty, join, map } from 'lodash-es';
import { watch, Ref, ref } from 'vue';
import { FeedProperty, XmlPropertyContainer } from '../types';
diff --git a/lib/admin/src/helpers.ts b/lib/admin/src/helpers.ts
index 9bb7197..d822200 100644
--- a/lib/admin/src/helpers.ts
+++ b/lib/admin/src/helpers.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { Ref, WatchSource, ref } from 'vue';
-import { throttle } from 'lodash';
+import { throttle } from 'lodash-es';
import { watchArray } from '@vueuse/core';
diff --git a/lib/admin/src/index.ts b/lib/admin/src/index.ts
index b5abe68..7733f5c 100644
--- a/lib/admin/src/index.ts
+++ b/lib/admin/src/index.ts
@@ -25,31 +25,37 @@ import { MaybeRef } from "vue";
import { get } from '@vueuse/core'
import { useRouteQuery } from "@vueuse/router";
import { QueryState, QueryType, SortType, BlogAdminContext } from "./types";
+import { RouteLocationNormalized, Router } from 'vue-router';
+import { AxiosInstance } from 'axios';
export interface BlogAdminConfig {
+ readonly axios: AxiosInstance;
+ readonly router: Router;
+ readonly route: RouteLocationNormalized;
readonly postUrl: MaybeRef<string>;
readonly contentUrl: MaybeRef<string>;
readonly channelUrl: MaybeRef<string>;
readonly defaultPageSize?: number;
}
-const createQueryState = (): QueryState => {
+const createQueryState = (router :Router , route : RouteLocationNormalized): QueryState => {
+
//setup filter search query
- const search = useRouteQuery<string>(QueryType.Filter, '', { mode: 'replace' });
+ const search = useRouteQuery<string>(QueryType.Filter, '', { mode: 'replace', route, router });
//Get sort order query
- const sort = useRouteQuery<SortType>(QueryType.Sort, SortType.CreatedTime, { mode: 'replace' });
+ const sort = useRouteQuery<SortType>(QueryType.Sort, SortType.CreatedTime, { mode: 'replace', route, router });
//Selected channel id
- const channel = useRouteQuery<string>(QueryType.Channel, '', { mode: 'replace' });
+ const channel = useRouteQuery<string>(QueryType.Channel, '', { mode: 'replace', route, router });
//Edits are in push mode because they are used to navigate to edit pages
- const channelEdit = useRouteQuery<string>(QueryType.ChannelEdit, '', { mode: 'push' });
+ const channelEdit = useRouteQuery<string>(QueryType.ChannelEdit, '', { mode: 'push', route, router });
- const content = useRouteQuery<string>(QueryType.Content, '', { mode: 'push' });
+ const content = useRouteQuery<string>(QueryType.Content, '', { mode: 'push', route, router });
//Get the selected post id from the route
- const post = useRouteQuery<string>(QueryType.Post, '', { mode: 'push' });
+ const post = useRouteQuery<string>(QueryType.Post, '', { mode: 'push', route, router });
return {
post,
@@ -66,12 +72,14 @@ const createQueryState = (): QueryState => {
* @param param0 The blog configuration object
* @returns A blog context object to pass to the blog admin components
*/
-export const createBlogContext = ({ channelUrl, postUrl, contentUrl }: BlogAdminConfig): BlogAdminContext => {
+export const createBlogContext = ({ channelUrl, postUrl, contentUrl, router, route, axios }: BlogAdminConfig): BlogAdminContext => {
- const queryState = createQueryState();
+ const queryState = createQueryState(router, route);
const getQuery = (): QueryState => queryState;
+ const getAxios = () : AxiosInstance => axios;
+
const getPostUrl = (): string => get(postUrl)
const getContentUrl = (): string => get(contentUrl)
@@ -79,6 +87,7 @@ export const createBlogContext = ({ channelUrl, postUrl, contentUrl }: BlogAdmin
const getChannelUrl = (): string => get(channelUrl)
return{
+ getAxios,
getQuery,
getPostUrl,
getChannelUrl,
diff --git a/lib/admin/src/ordering/index.ts b/lib/admin/src/ordering/index.ts
index 12cbf3c..a2f266f 100644
--- a/lib/admin/src/ordering/index.ts
+++ b/lib/admin/src/ordering/index.ts
@@ -15,7 +15,7 @@
import { MaybeRefOrGetter, computed } from 'vue';
import { useOffsetPagination } from '@vueuse/core';
-import { filter, includes, isEmpty, orderBy, slice, toLower } from 'lodash';
+import { filter, includes, isEmpty, orderBy, slice, toLower } from 'lodash-es';
import { CanPaginate, NamedBlogEntity, SortedFilteredPaged } from '../types';
/**
diff --git a/lib/admin/src/posts/computedPosts.ts b/lib/admin/src/posts/computedPosts.ts
index 61be169..44171a5 100644
--- a/lib/admin/src/posts/computedPosts.ts
+++ b/lib/admin/src/posts/computedPosts.ts
@@ -14,7 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { computed } from "vue";
-import { isEqual, find } from "lodash";
+import { isEqual, find } from 'lodash-es';
import { apiCall } from "@vnuge/vnlib.browser";
import { PostMeta, ComputedPosts, BlogAdminContext } from "../types";
import { usePostApi } from "./usePost";
diff --git a/lib/admin/src/posts/usePost.ts b/lib/admin/src/posts/usePost.ts
index 56d0f17..1d93b6b 100644
--- a/lib/admin/src/posts/usePost.ts
+++ b/lib/admin/src/posts/usePost.ts
@@ -13,8 +13,8 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-import { isArray, orderBy } from "lodash";
-import { WebMessage, useAxios } from "@vnuge/vnlib.browser"
+import { isArray, orderBy } from 'lodash-es';
+import { WebMessage } from "@vnuge/vnlib.browser"
import { PostMeta, PostApi, BlogAdminContext } from "../types";
/**
@@ -23,7 +23,7 @@ import { PostMeta, PostApi, BlogAdminContext } from "../types";
* @returns The configured post api
*/
export const usePostApi = (context : BlogAdminContext): PostApi => {
- const axios = useAxios(null);
+ const axios = context.getAxios();
const { channel } = context.getQuery();
diff --git a/lib/admin/src/types.ts b/lib/admin/src/types.ts
index 2d3a56c..f94932a 100644
--- a/lib/admin/src/types.ts
+++ b/lib/admin/src/types.ts
@@ -14,6 +14,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { UseOffsetPaginationReturn } from '@vueuse/core';
+import { AxiosInstance } from 'axios';
import { Dictionary } from 'lodash';
import { Ref } from 'vue';
@@ -267,4 +268,5 @@ export interface BlogAdminContext {
getPostUrl(): string;
getContentUrl(): string;
getChannelUrl(): string;
+ getAxios(): AxiosInstance;
} \ No newline at end of file