1.2.28 • Published 5 months ago

iwish-core-frontend v1.2.28

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

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

1.2.27

5 months ago

1.2.28

5 months ago

1.2.26

5 months ago

1.2.25

5 months ago

1.2.24

6 months ago

1.2.20

8 months ago

1.2.23

8 months ago

1.2.21

8 months ago

1.2.22

8 months ago

1.2.18

9 months ago

1.2.17

9 months ago

1.2.16

9 months ago

1.2.15

9 months ago

1.2.14

9 months ago

1.2.13

9 months ago

1.2.12

9 months ago

1.2.11

10 months ago

1.2.10

10 months ago

1.2.9

10 months ago

1.2.8

10 months ago

1.2.7

10 months ago

1.2.6

10 months ago

1.2.5

10 months ago

1.2.4

10 months ago

1.2.3

10 months ago

1.2.2

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.0

11 months ago

1.0.3

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago