# iwish-core-frontend

> response of api calls are in this format :

Latest version **1.2.28** (published 2024-01-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install iwish-core-frontend
pnpm add iwish-core-frontend
yarn add iwish-core-frontend
bun add iwish-core-frontend
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.28 |
| Published | 2024-01-01 |
| First published | 2023-06-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 9.7 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | sadram |

## Links

- npm: https://www.npmjs.com/package/iwish-core-frontend
- npm.io page: https://npm.io/package/iwish-core-frontend

## Dependencies (6)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [sass](https://npm.io/package/sass.md) ^1.63.6
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [react-cookie](https://npm.io/package/react-cookie.md) ^4.1.1
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.15.2
- [rollup-plugin-scss](https://npm.io/package/rollup-plugin-scss.md) ^4.0.0

## Recent versions

- 1.2.28 (latest) — 2024-01-01
- 1.2.27 — 2024-01-01
- 1.2.26 — 2023-12-26
- 1.2.25 — 2023-12-20
- 1.2.24 — 2023-11-13
- 1.2.23 — 2023-09-19
- 1.2.22 — 2023-09-12
- 1.2.21 — 2023-09-11
- 1.2.20 — 2023-09-11
- 1.2.18 — 2023-08-28
- 1.2.17 — 2023-08-22
- 1.2.16 — 2023-08-17
- 1.2.15 — 2023-08-15
- 1.2.14 — 2023-08-14
- 1.2.13 — 2023-08-14
- … 26 more at https://npm.io/package/iwish-core-frontend/versions

## README

# iwish-core


## useful hooks



response of api calls are in this format :

```
interface IApiResponse {
    code: number;
    success: boolean;
    loading: boolean;
    message: string;
    data: any;
    errors: {},
}
```

```
enum authGuard {
    none = 0,
    client = 1,
    panel = 2,
    admin_panel = 3,
}

enum API_METHODS  {
    POST   = 'post',
    GET    = 'get',
    PUT    = 'put',
    DELETE = 'delete',
}

interface IFetch {
    url: string;
    body: {}
}

interface IFetchInputs extends IFetch {
    // method: API_METHODS;
    method: 'post' | 'get' | 'put' | 'delete';
    authGuard?: authGuard;
    header?:IHeaders;
}

interface IHeaderItem {
    header: string;
    value: string;    
}

interface IHeaders extends Array<IHeaderItem> {}
```


### useIwishCoreAuth


- requestOtpCode \<IRequestOtpCodeProps\>

- login \<ILoginProps\>

- loginOAuth \<ILoginWithTokenProps\>

- register \<IRegisterProps\>

- reset \<IResetProps\>

- refresh \<\>

- logout \<\>

- getMe \<\>


```
interface IAuth {
    mobile?: string;
    authGuard: authGuard;
}

interface IRequestOtpCodeProps extends IAuth {
    mobile: string;
}

interface ILoginProps extends IAuth {
    password: string;
}

interface IRegisterProps extends IAuth {
    verification_code: string;
    password: string;
}

interface IResetProps extends IAuth {
    password: string,
    password_confirmation: string,
    verification_code: string
}

interface ILoginWithTokenProps extends Omit<IAuth, "mobile"> {
    oauth: string
}
```

### useIwishCoreCookie

- checkHasAuthCookie

- getDataFromCookie

- addDataToCookie

- removeDataCookie

### useIwishCoreFetch

- fetch \<IFetchInputs\>


### useIwishCoreFetchSurvey

- getSurvey

- getSurveys

- createSurvey

- updateSurvey

- deleteSurvey

- getSurveyAnswers

- updateSurveyQuestions

---
_Source: https://npm.io/package/iwish-core-frontend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
