1.2.28 • Published 1 year ago

iwish-core-frontend v1.2.28

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year 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

1 year ago

1.2.28

1 year ago

1.2.26

2 years ago

1.2.25

2 years ago

1.2.24

2 years ago

1.2.20

2 years ago

1.2.23

2 years ago

1.2.21

2 years ago

1.2.22

2 years ago

1.2.18

2 years ago

1.2.17

2 years ago

1.2.16

2 years ago

1.2.15

2 years ago

1.2.14

2 years ago

1.2.13

2 years ago

1.2.12

2 years ago

1.2.11

2 years ago

1.2.10

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago