🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

reactstrap-react-lib

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactstrap-react-lib - npm Package Compare versions

Comparing version

to
1.0.4

9

lib/lib/forms/FormDelete.d.ts
/// <reference types="react" />
import { AxiosError, AxiosResponse } from 'axios';
interface Props {

@@ -7,5 +8,11 @@ /**This API uri for deleteing Post request */

id: any;
onSuccess?: (res: AxiosResponse, ...args: any) => any;
/**
* This function is call back on error from server HTTP response
* @error error eecived from server
*/
onError?: (error: AxiosError, ...args: any) => any;
}
declare function Delete({ uri, id }: Props): JSX.Element;
declare function Delete({ uri, id, onSuccess, onError }: Props): JSX.Element;
export default Delete;
//# sourceMappingURL=FormDelete.d.ts.map

36

lib/lib/forms/FormDelete.js

@@ -40,11 +40,12 @@ "use strict";

const ModelP_1 = __importDefault(require("../ModelP"));
function Delete({ uri, id }) {
const butRef = react_1.useRef();
const modRef = react_1.useRef();
const alerRef = react_1.useRef();
const submitHandle = () => __awaiter(this, void 0, void 0, function* () {
function Delete({ uri, id, onSuccess, onError }) {
const butRef = react_1.useRef(null);
const modRef = react_1.useRef(null);
const alerRef = react_1.useRef(null);
const submitHandle = (onSuccess, onError) => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e, _f, _g;
try {
modRef.current.close();
butRef.current.showSpin();
alerRef.current.alertLight();
(_a = modRef.current) === null || _a === void 0 ? void 0 : _a.close();
(_b = butRef.current) === null || _b === void 0 ? void 0 : _b.showSpin();
(_c = alerRef.current) === null || _c === void 0 ? void 0 : _c.alertLight();
let curObj = {

@@ -54,9 +55,10 @@ id: id,

let res = yield axios_1.default.post(uri, curObj).then(res => res);
butRef.current.hideSpin();
alerRef.current.alertSuccess(res.data.mes);
(_d = butRef.current) === null || _d === void 0 ? void 0 : _d.hideSpin();
(_e = alerRef.current) === null || _e === void 0 ? void 0 : _e.alertSuccess(res.data.mes);
onSuccess(res);
}
catch (error) {
console.log(error);
butRef.current.hideSpin();
alerRef.current.alertError(error);
(_f = butRef.current) === null || _f === void 0 ? void 0 : _f.hideSpin();
(_g = alerRef.current) === null || _g === void 0 ? void 0 : _g.alertError(error);
onError(error);
}

@@ -68,8 +70,10 @@ });

react_1.default.createElement(ModelP_1.default, { ref: modRef, Ok: (e) => {
submitHandle();
modRef.current.close();
var _a;
submitHandle(onSuccess, onError);
(_a = modRef.current) === null || _a === void 0 ? void 0 : _a.close();
} }),
react_1.default.createElement(reactstrap_1.Form, { onSubmit: (e) => {
var _a;
e.preventDefault();
modRef.current.show();
(_a = modRef.current) === null || _a === void 0 ? void 0 : _a.show();
} },

@@ -76,0 +80,0 @@ react_1.default.createElement(ButtonP_1.default, { text: "Delete", color: "danger", ref: butRef })),

@@ -0,1 +1,2 @@

import { AxiosError, AxiosResponse } from 'axios';
import { ReactFragment } from 'react';

@@ -15,3 +16,3 @@ interface Props {

*/
onSuccess?: (res: any, ...args: any) => any;
onSuccess?: (res: AxiosResponse, ...args: any) => any;
/**

@@ -21,3 +22,3 @@ * This function is call back on error from server HTTP response

*/
onError?: (error: any, ...args: any) => any;
onError?: (error: AxiosError, ...args: any) => any;
}

@@ -24,0 +25,0 @@ declare const FormSubmit: ({ curObj, curUri, Inputs, reset, onSuccess, onError }: Props) => JSX.Element;

{
"name": "reactstrap-react-lib",
"version": "1.0.3",
"version": "1.0.4",
"description": "This is a lib for react and next",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet