iwish-core-frontend v1.2.28
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
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago