Skip to content

Instantly share code, notes, and snippets.

@Gid733
Gid733 / Crud.actions.ts
Last active August 11, 2021 17:24
Webstorm react typescript live templates
// Get all
export const get$Entity$s = createAction("$ENTITY_CAP$S/GET_$ENTITY_CAP$S");
export const get$Entity$sSuccess = createAction<PagedType<any>>(
"$ENTITY_CAP$S/GET_$ENTITY_CAP$S_SUCCESS"
);
export const get$Entity$sError = createAction<PayloadError[]>(
"$ENTITY_CAP$S/GET_$ENTITY_CAP$_ERROR"
import { toast } from "react-toastify";
import axios from "axios";
import { getCurrentUser } from "../helpers/auth.helper";
import { dispatch } from "../../redux/root.store";
import { logoutUser } from "../../redux/actions/auth/auth.actions";
export const axiosBase = axios.create();
axiosBase.interceptors.request.use(function(request) {
debugger;
@Gid733
Gid733 / Actions.ts
Created November 21, 2019 21:01
Typescript gist
export const $ACTION_NAME$ = "$ACTION_NAME$";
export const $ACTION_NAME$_SUCCESS = "$ACTION_NAME$_SUCCESS";
export const $ACTION_NAME$_ERROR = "$ACTION_NAME$_ERROR";
// action types
export interface $ACTION_NAME_CLASSIFY$Action {
type: typeof $ACTION_NAME$,
payload: any
}
@Gid733
Gid733 / Actions.js
Last active October 30, 2019 12:02
Webstorm snippets
export const $ACTION$ = "$ACTION$";
export const $ACTION$_SUCCESS = "$ACTION$_SUCCESS";
export const $ACTION$_ERROR = "$ACTION$_ERROR";
export function $ACTION_FUNC$($3$) {
return {
type: $ACTION$,
$3$
};
}