mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(experience): update some namings
update some namings
This commit is contained in:
parent
9cf32258ff
commit
a0fbd7fcf1
3 changed files with 11 additions and 10 deletions
|
@ -10,9 +10,10 @@ import api from './api';
|
|||
|
||||
const prefix = '/api/experience';
|
||||
|
||||
const experienceRoutes = Object.freeze({
|
||||
const experienceApiRoutes = Object.freeze({
|
||||
prefix,
|
||||
identification: `${prefix}/identification`,
|
||||
submit: `${prefix}/submit`,
|
||||
verification: `${prefix}/verification`,
|
||||
profile: `${prefix}/profile`,
|
||||
mfa: `${prefix}/profile/mfa`,
|
||||
|
@ -27,27 +28,27 @@ type SubmitInteractionResponse = {
|
|||
};
|
||||
|
||||
const initInteraction = async (interactionEvent: InteractionEvent) =>
|
||||
api.put(`${experienceRoutes.prefix}`, {
|
||||
api.put(`${experienceApiRoutes.prefix}`, {
|
||||
json: {
|
||||
interactionEvent,
|
||||
},
|
||||
});
|
||||
|
||||
const identifyUser = async (payload: IdentificationApiPayload = {}) =>
|
||||
api.post(experienceRoutes.identification, { json: payload });
|
||||
api.post(experienceApiRoutes.identification, { json: payload });
|
||||
|
||||
const submitInteraction = async () =>
|
||||
api.post(`${experienceRoutes.prefix}/submit`).json<SubmitInteractionResponse>();
|
||||
api.post(`${experienceApiRoutes.submit}`).json<SubmitInteractionResponse>();
|
||||
|
||||
const updateProfile = async (payload: UpdateProfileApiPayload) => {
|
||||
await api.post(experienceRoutes.profile, { json: payload });
|
||||
await api.post(experienceApiRoutes.profile, { json: payload });
|
||||
};
|
||||
|
||||
export const signInWithPasswordIdentifier = async (payload: PasswordVerificationPayload) => {
|
||||
await initInteraction(InteractionEvent.SignIn);
|
||||
|
||||
const { verificationId } = await api
|
||||
.post(`${experienceRoutes.verification}/password`, {
|
||||
.post(`${experienceApiRoutes.verification}/password`, {
|
||||
json: payload,
|
||||
})
|
||||
.json<VerificationResponse>();
|
||||
|
|
|
@ -3,11 +3,11 @@ import { useCallback } from 'react';
|
|||
import usePasswordErrorMessage from './use-password-error-message';
|
||||
import { usePasswordPolicy } from './use-sie';
|
||||
|
||||
type PasswordPolicyCheckProps = {
|
||||
type Options = {
|
||||
setErrorMessage: (message?: string) => void;
|
||||
};
|
||||
|
||||
const usePasswordPolicyChecker = ({ setErrorMessage }: PasswordPolicyCheckProps) => {
|
||||
const usePasswordPolicyChecker = ({ setErrorMessage }: Options) => {
|
||||
const { getErrorMessage } = usePasswordErrorMessage();
|
||||
const { policyChecker } = usePasswordPolicy();
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ import { useCallback, useMemo } from 'react';
|
|||
import type { ErrorHandlers } from './use-error-handler';
|
||||
import usePasswordErrorMessage from './use-password-error-message';
|
||||
|
||||
type ErrorHandlerProps = {
|
||||
type Options = {
|
||||
setErrorMessage: (message?: string) => void;
|
||||
};
|
||||
|
||||
const usePasswordRejectionErrorHandler = ({ setErrorMessage }: ErrorHandlerProps) => {
|
||||
const usePasswordRejectionErrorHandler = ({ setErrorMessage }: Options) => {
|
||||
const { getErrorMessageFromBody } = usePasswordErrorMessage();
|
||||
|
||||
const passwordRejectionHandler = useCallback(
|
||||
|
|
Loading…
Reference in a new issue