feat(dimentorin): mentor register flow wired to API (4-step form, validation, submit, redirect pending)

This commit is contained in:
asepharyana
2026-08-04 20:04:41 +07:00
parent 583b6b224e
commit 6c5c5db47b
4 changed files with 214 additions and 171 deletions
+12
View File
@@ -6,6 +6,7 @@ import {
TMentorAvailability,
TMentorDetail,
TMentorListParams,
TMentorRegisterRequest,
TSessionFeedbackRequest,
TSessionListResponse,
TBookSessionRequest,
@@ -133,3 +134,14 @@ export const getArticleById = async (id: string): Promise<TArticleDetail> => {
});
return data.data;
};
export const postRegisterMentor = async (
payload: TMentorRegisterRequest
): Promise<TResponseMessage> => {
const { data } = await api({
method: 'POST',
url: '/dimentorin/mentors/create',
data: payload,
});
return data;
};
@@ -12,6 +12,7 @@ import {
getMentors,
getMySessions,
postBookSession,
postRegisterMentor,
postSessionFeedback,
} from '../../api/dimentorin';
import {
@@ -22,6 +23,7 @@ import {
TMentorAvailability,
TMentorDetail,
TMentorListParams,
TMentorRegisterRequest,
TSessionFeedbackRequest,
TSessionListResponse,
} from '../../types/dimentorin';
@@ -112,6 +114,14 @@ export const usePostSessionFeedback = (sessionId: string) => {
});
};
export const usePostRegisterMentor = () => {
return useMutation({
mutationKey: ['post-register-mentor'],
mutationFn: async (payload: TMentorRegisterRequest) =>
await postRegisterMentor(payload),
});
};
export const useGetArticles = (
params?: TArticleListParams
): UseQueryResult<TArticleListItem[], TResponseError> => {
@@ -120,3 +120,38 @@ export type TArticleListParams = {
per_page?: number;
category?: string;
};
export type TMentorRegisterRequest = {
email: string;
password: string;
fullname: string;
phone_number?: string | null;
identity_and_verification: {
legal_name: string;
gender?: string | null;
domicile?: string | null;
identity_document_url: string;
phone_for_verification?: string | null;
};
professional_profile: {
bio: string;
last_education?: string | null;
linkedin_url?: string | null;
github_url?: string | null;
cv_url?: string | null;
portfolio_url?: string | null;
industries: string[];
expertise: string[];
languages: string[];
current_company: string;
current_role: string;
years_of_experience: number;
};
mentoring_logistics: {
topics_of_interest: string[];
preferred_mentee_level: string[];
preferred_mentoring_formats: string[];
availability_commitment: string;
mentoring_rate_amount: number;
};
};