
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@drieam/common
Advanced tools
This package include some utilities used by Drieam LTI apps.
Install the @drieam/common and its dependencies.
yarn add @drieam/common @drieam/api @drieam/models @drieam/ui
import { connectActions, connectReducers } from "@drieam/api";
import { User } from "../models";
import { setStore } from "@drieam/common";
type API = {
user: User
};
type Store = RootReducer<{
api: ConnectReducers<API>
}>;
const api: ApiRoutes<API> = {
user: {
onError,
path: "/lti/proxy/api/v1/users/:id?",
mapper: User,
list: true
}
};
const actions = connectActions < API > api;
const rootReducer = connectReducers < API > api;
const store = setStore(
api,
rootReducer,
[
/** EMPTY MIDDLEWARES **/
],
defaultOptions
)({
/* EMPTY INITIAL STATE */
});
Read the full API Documentation
setStore(...) => Store
Create a redux store.
api
(ReactRoutes
): Rest API configuration.rootReducer
(Reducer
): Root combined reducers.extraMiddlewares
(Middleware[]
): Array of redux middlewares.options
(object
): Configuration options.import { setStore } from '@drieam/common';
...
type Store = RootReducer<{
api: ConnectReducers<API>;
}>;
...
const store = setStore(
api,
rootReducer,
[/** EMPTY MIDDLEWARES **/],
defaultOptions,
)({
/* EMPTY INITIAL STATE */
});
Store
: The redux store.Options
General settings of an action as an extension of api actions.
{
withErrorHandler: true,
csrfToken: getCSRFToken(),
history: createBrowserHistory(),
toasts: {
offline: {
duration: 0,
message: 'Not connected.',
},
save: { message: 'Saved success.' },
delete: { message: 'Deleted success.' },
},
};
}
withErrorHandler
(boolean
): Enables ErrorHandlingMiddleware (Default: true
). Provides feedback through an Antd Notification on offline, save success or fail action.toasts
(object
): Notification settings, you can express which message can be provided by the error handler.history
(object
): history
is a JavaScript library that lets you easily manage session history anywhere JavaScript runs. (default: require 'history'
).csfrToken
(string
): Cross-site request forgery token. (Default: <meta [name="csrf-token"] />
).FAQs
Default Drieam api wrapper
The npm package @drieam/common receives a total of 2 weekly downloads. As such, @drieam/common popularity was classified as not popular.
We found that @drieam/common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.