//
// SPDX-License-Identifier: AGPL-3.0
-import { ofType, default as unionize, UnionOf } from "unionize";
+import { ofType, unionize, UnionOf } from '~/common/unionize';
import { Dispatch } from "redux";
import { User } from "~/models/user";
import { RootState } from "../store";
import { ServiceRepository } from "~/services/services";
import { AxiosInstance } from "axios";
-import { initSidePanelTree } from '../side-panel-tree/side-panel-tree-actions';
-import { updateResources } from '../resources/resources-actions';
export const authActions = unionize({
SAVE_API_TOKEN: ofType<string>(),
INIT: ofType<{ user: User, token: string }>(),
USER_DETAILS_REQUEST: {},
USER_DETAILS_SUCCESS: ofType<User>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
function setAuthorizationHeader(services: ServiceRepository, token: string) {
services.apiClient.defaults.headers.common = {
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { CollectionFilesTree, CollectionFileType } from "~/models/collection-file";
import { ServiceRepository } from "~/services/services";
TOGGLE_COLLECTION_FILE_SELECTION: ofType<{ id: string }>(),
SELECT_ALL_COLLECTION_FILES: ofType<{}>(),
UNSELECT_ALL_COLLECTION_FILES: ofType<{}>(),
-}, { tag: 'type', value: 'payload' });
+});
export type CollectionPanelFilesAction = UnionOf<typeof collectionPanelFilesAction>;
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { RootState } from "../../store";
CLOSE_COLLECTION_CREATOR: ofType<{}>(),
CREATE_COLLECTION: ofType<{}>(),
CREATE_COLLECTION_SUCCESS: ofType<{}>(),
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type CollectionCreateAction = UnionOf<typeof collectionCreateActions>;
//\r
// SPDX-License-Identifier: AGPL-3.0\r
\r
-import { default as unionize, ofType, UnionOf } from "unionize";\r
+import { unionize, ofType, UnionOf } from "~/common/unionize";\r
import { Dispatch } from 'redux';\r
import { RootState } from '~/store/store';\r
import { ServiceRepository } from '~/services/services';\r
START_UPLOAD: ofType(),\r
SET_UPLOAD_PROGRESS: ofType<{ fileId: number, loaded: number, total: number, currentTime: number }>(),\r
CLEAR_UPLOAD: ofType()\r
-}, {\r
- tag: 'type',\r
- value: 'payload'\r
});\r
\r
export type CollectionUploaderAction = UnionOf<typeof collectionUploaderActions>;\r
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { DataTableFilterItem } from "~/components/data-table-filters/data-table-filters";
import { DataColumns } from "~/components/data-table/data-table";
TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
-}, { tag: "type", value: "payload" });
+});
export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
export const dialogActions = unionize({
OPEN_DIALOG: ofType<{ id: string, data: any }>(),
CLOSE_DIALOG: ofType<{ id: string }>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type DialogAction = UnionOf<typeof dialogActions>;
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { Dispatch } from "redux";
import { RootState } from "../store";
import { checkFavorite } from "./favorites-reducer";
TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
CHECK_PRESENCE_IN_FAVORITES: ofType<string[]>(),
UPDATE_FAVORITES: ofType<Record<string, boolean>>()
-}, { tag: 'type', value: 'payload' });
+});
export type FavoritesAction = UnionOf<typeof favoritesActions>;
//
// SPDX-License-Identifier: AGPL-3.0
-import { unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
export const snackbarActions = unionize({
OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number}>(),
CLOSE_SNACKBAR: ofType<{}>()
-}, { tag: 'type', value: 'payload' });
+});
export type SnackbarAction = UnionOf<typeof snackbarActions>;
//
// SPDX-License-Identifier: AGPL-3.0
-import { default as unionize, ofType, UnionOf } from "unionize";
+import { unionize, ofType, UnionOf } from "~/common/unionize";
import { TreePickerNode } from "./tree-picker";
TOGGLE_TREE_PICKER_NODE_COLLAPSE: ofType<{ nodeId: string, pickerId: string }>(),
TOGGLE_TREE_PICKER_NODE_SELECT: ofType<{ nodeId: string, pickerId: string }>(),
RESET_TREE_PICKER: ofType<{ pickerId: string }>()
-}, {
- tag: 'type',
- value: 'payload'
- });
+});
export type TreePickerAction = UnionOf<typeof treePickerActions>;