Compare commits
4 Commits
6411268090
...
c43c37a127
| Author | SHA1 | Date | |
|---|---|---|---|
|
c43c37a127
|
|||
|
5cf00407b4
|
|||
|
f4a5b37892
|
|||
|
3c4e078bdd
|
@@ -3,8 +3,27 @@
|
|||||||
import { type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
import { type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
||||||
|
|
||||||
import { client } from '../client.gen';
|
import { client } from '../client.gen';
|
||||||
import { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from '../sdk.gen';
|
import { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventJoined, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAgendaSubmit, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from '../sdk.gen';
|
||||||
import type { GetAuthRedirectData, GetAuthRedirectError, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceResponse, GetEventCheckinData, GetEventCheckinError, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryResponse, GetEventCheckinResponse, GetEventInfoData, GetEventInfoError, GetEventInfoResponse, GetEventListData, GetEventListError, GetEventListResponse, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, GetUserInfoData, GetUserInfoError, GetUserInfoResponse, GetUserListData, GetUserListError, GetUserListResponse, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateResponse, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeResponse, PostAuthMagicData, PostAuthMagicError, PostAuthMagicResponse, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshResponse, PostAuthTokenData, PostAuthTokenError, PostAuthTokenResponse, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitResponse, PostEventJoinData, PostEventJoinError, PostEventJoinResponse, PostKycQueryData, PostKycQueryError, PostKycQueryResponse, PostKycSessionData, PostKycSessionError, PostKycSessionResponse } from '../types.gen';
|
import type { GetAuthRedirectData, GetAuthRedirectError, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceResponse, GetEventCheckinData, GetEventCheckinError, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryResponse, GetEventCheckinResponse, GetEventInfoData, GetEventInfoError, GetEventInfoResponse, GetEventJoinedData, GetEventJoinedError, GetEventJoinedResponse, GetEventListData, GetEventListError, GetEventListResponse, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdResponse, GetUserInfoData, GetUserInfoError, GetUserInfoResponse, GetUserListData, GetUserListError, GetUserListResponse, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateResponse, PostAgendaSubmitData, PostAgendaSubmitError, PostAgendaSubmitResponse, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeResponse, PostAuthMagicData, PostAuthMagicError, PostAuthMagicResponse, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshResponse, PostAuthTokenData, PostAuthTokenError, PostAuthTokenResponse, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitResponse, PostEventJoinData, PostEventJoinError, PostEventJoinResponse, PostKycQueryData, PostKycQueryError, PostKycQueryResponse, PostKycSessionData, PostKycSessionError, PostKycSessionResponse } from '../types.gen';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit Agenda
|
||||||
|
*
|
||||||
|
* Creates a new agenda item for a specific attendance record.
|
||||||
|
*/
|
||||||
|
export const postAgendaSubmitMutation = (options?: Partial<Options<PostAgendaSubmitData>>): UseMutationOptions<PostAgendaSubmitResponse, PostAgendaSubmitError, Options<PostAgendaSubmitData>> => {
|
||||||
|
const mutationOptions: UseMutationOptions<PostAgendaSubmitResponse, PostAgendaSubmitError, Options<PostAgendaSubmitData>> = {
|
||||||
|
mutationFn: async (fnOptions) => {
|
||||||
|
const { data } = await postAgendaSubmit({
|
||||||
|
...options,
|
||||||
|
...fnOptions,
|
||||||
|
throwOnError: true
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return mutationOptions;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exchange Auth Code
|
* Exchange Auth Code
|
||||||
@@ -253,16 +272,16 @@ export const postEventJoinMutation = (options?: Partial<Options<PostEventJoinDat
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getEventListQueryKey = (options: Options<GetEventListData>) => createQueryKey('getEventList', options);
|
export const getEventJoinedQueryKey = (options?: Options<GetEventJoinedData>) => createQueryKey('getEventJoined', options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List Events
|
* Get Joined Events
|
||||||
*
|
*
|
||||||
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
* Fetches a list of events where the authenticated user is a participant. Supports pagination.
|
||||||
*/
|
*/
|
||||||
export const getEventListOptions = (options: Options<GetEventListData>) => queryOptions<GetEventListResponse, GetEventListError, GetEventListResponse, ReturnType<typeof getEventListQueryKey>>({
|
export const getEventJoinedOptions = (options?: Options<GetEventJoinedData>) => queryOptions<GetEventJoinedResponse, GetEventJoinedError, GetEventJoinedResponse, ReturnType<typeof getEventJoinedQueryKey>>({
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getEventList({
|
const { data } = await getEventJoined({
|
||||||
...options,
|
...options,
|
||||||
...queryKey[0],
|
...queryKey[0],
|
||||||
signal,
|
signal,
|
||||||
@@ -270,7 +289,7 @@ export const getEventListOptions = (options: Options<GetEventListData>) => query
|
|||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
queryKey: getEventListQueryKey(options)
|
queryKey: getEventJoinedQueryKey(options)
|
||||||
});
|
});
|
||||||
|
|
||||||
const createInfiniteParams = <K extends Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey<Options>, page: K) => {
|
const createInfiniteParams = <K extends Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>>(queryKey: QueryKey<Options>, page: K) => {
|
||||||
@@ -302,14 +321,63 @@ const createInfiniteParams = <K extends Pick<QueryKey<Options>[0], 'body' | 'hea
|
|||||||
return params as unknown as typeof page;
|
return params as unknown as typeof page;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getEventListInfiniteQueryKey = (options: Options<GetEventListData>): QueryKey<Options<GetEventListData>> => createQueryKey('getEventList', options, true);
|
export const getEventJoinedInfiniteQueryKey = (options?: Options<GetEventJoinedData>): QueryKey<Options<GetEventJoinedData>> => createQueryKey('getEventJoined', options, true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Joined Events
|
||||||
|
*
|
||||||
|
* Fetches a list of events where the authenticated user is a participant. Supports pagination.
|
||||||
|
*/
|
||||||
|
export const getEventJoinedInfiniteOptions = (options?: Options<GetEventJoinedData>) => infiniteQueryOptions<GetEventJoinedResponse, GetEventJoinedError, InfiniteData<GetEventJoinedResponse>, QueryKey<Options<GetEventJoinedData>>, number | Pick<QueryKey<Options<GetEventJoinedData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||||
|
// @ts-ignore
|
||||||
|
{
|
||||||
|
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||||
|
// @ts-ignore
|
||||||
|
const page: Pick<QueryKey<Options<GetEventJoinedData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
||||||
|
query: {
|
||||||
|
offset: pageParam
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const params = createInfiniteParams(queryKey, page);
|
||||||
|
const { data } = await getEventJoined({
|
||||||
|
...options,
|
||||||
|
...params,
|
||||||
|
signal,
|
||||||
|
throwOnError: true
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
queryKey: getEventJoinedInfiniteQueryKey(options)
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getEventListQueryKey = (options?: Options<GetEventListData>) => createQueryKey('getEventList', options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List Events
|
* List Events
|
||||||
*
|
*
|
||||||
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
||||||
*/
|
*/
|
||||||
export const getEventListInfiniteOptions = (options: Options<GetEventListData>) => infiniteQueryOptions<GetEventListResponse, GetEventListError, InfiniteData<GetEventListResponse>, QueryKey<Options<GetEventListData>>, number | Pick<QueryKey<Options<GetEventListData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
export const getEventListOptions = (options?: Options<GetEventListData>) => queryOptions<GetEventListResponse, GetEventListError, GetEventListResponse, ReturnType<typeof getEventListQueryKey>>({
|
||||||
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
|
const { data } = await getEventList({
|
||||||
|
...options,
|
||||||
|
...queryKey[0],
|
||||||
|
signal,
|
||||||
|
throwOnError: true
|
||||||
|
});
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
queryKey: getEventListQueryKey(options)
|
||||||
|
});
|
||||||
|
|
||||||
|
export const getEventListInfiniteQueryKey = (options?: Options<GetEventListData>): QueryKey<Options<GetEventListData>> => createQueryKey('getEventList', options, true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Events
|
||||||
|
*
|
||||||
|
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
||||||
|
*/
|
||||||
|
export const getEventListInfiniteOptions = (options?: Options<GetEventListData>) => infiniteQueryOptions<GetEventListResponse, GetEventListError, InfiniteData<GetEventListResponse>, QueryKey<Options<GetEventListData>>, number | Pick<QueryKey<Options<GetEventListData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
{
|
{
|
||||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||||
@@ -369,14 +437,14 @@ export const postKycSessionMutation = (options?: Partial<Options<PostKycSessionD
|
|||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUserInfoQueryKey = (options: Options<GetUserInfoData>) => createQueryKey('getUserInfo', options);
|
export const getUserInfoQueryKey = (options?: Options<GetUserInfoData>) => createQueryKey('getUserInfo', options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get My User Information
|
* Get My User Information
|
||||||
*
|
*
|
||||||
* Fetches the complete profile data for the user associated with the provided session/token.
|
* Fetches the complete profile data for the user associated with the provided session/token.
|
||||||
*/
|
*/
|
||||||
export const getUserInfoOptions = (options: Options<GetUserInfoData>) => queryOptions<GetUserInfoResponse, GetUserInfoError, GetUserInfoResponse, ReturnType<typeof getUserInfoQueryKey>>({
|
export const getUserInfoOptions = (options?: Options<GetUserInfoData>) => queryOptions<GetUserInfoResponse, GetUserInfoError, GetUserInfoResponse, ReturnType<typeof getUserInfoQueryKey>>({
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getUserInfo({
|
const { data } = await getUserInfo({
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ import type { ClientOptions as ClientOptions2 } from './types.gen';
|
|||||||
*/
|
*/
|
||||||
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
||||||
|
|
||||||
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:8000/api/v1' }));
|
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: 'http://localhost:8000/app/api/v1' }));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
export { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from './sdk.gen';
|
export { getAuthRedirect, getEventAttendance, getEventCheckin, getEventCheckinQuery, getEventInfo, getEventJoined, getEventList, getUserInfo, getUserInfoByUserId, getUserList, type Options, patchUserUpdate, postAgendaSubmit, postAuthExchange, postAuthMagic, postAuthRefresh, postAuthToken, postEventCheckinSubmit, postEventJoin, postKycQuery, postKycSession } from './sdk.gen';
|
||||||
export type { ClientOptions, DataEventIndexDoc, DataUserIndexDoc, GetAuthRedirectData, GetAuthRedirectError, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceErrors, GetEventAttendanceResponse, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinError, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryErrors, GetEventCheckinQueryResponse, GetEventCheckinQueryResponses, GetEventCheckinResponse, GetEventCheckinResponses, GetEventInfoData, GetEventInfoError, GetEventInfoErrors, GetEventInfoResponse, GetEventInfoResponses, GetEventListData, GetEventListError, GetEventListErrors, GetEventListResponse, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponse, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserListData, GetUserListError, GetUserListErrors, GetUserListResponse, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateErrors, PatchUserUpdateResponse, PatchUserUpdateResponses, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeErrors, PostAuthExchangeResponse, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicError, PostAuthMagicErrors, PostAuthMagicResponse, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshErrors, PostAuthRefreshResponse, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenError, PostAuthTokenErrors, PostAuthTokenResponse, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponse, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinError, PostEventJoinErrors, PostEventJoinResponse, PostEventJoinResponses, PostKycQueryData, PostKycQueryError, PostKycQueryErrors, PostKycQueryResponse, PostKycQueryResponses, PostKycSessionData, PostKycSessionError, PostKycSessionErrors, PostKycSessionResponse, PostKycSessionResponses, ServiceAuthExchangeData, ServiceAuthExchangeResponse, ServiceAuthMagicData, ServiceAuthMagicResponse, ServiceAuthRefreshData, ServiceAuthTokenData, ServiceAuthTokenResponse, ServiceEventAttendanceListResponse, ServiceEventCheckinQueryResponse, ServiceEventCheckinResponse, ServiceEventCheckinSubmitData, ServiceEventEventJoinData, ServiceKycKycQueryData, ServiceKycKycQueryResponse, ServiceKycKycSessionData, ServiceKycKycSessionResponse, ServiceUserUserInfoData, UtilsRespStatus } from './types.gen';
|
export type { ClientOptions, DataEventIndexDoc, DataUserIndexDoc, GetAuthRedirectData, GetAuthRedirectError, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceError, GetEventAttendanceErrors, GetEventAttendanceResponse, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinError, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryError, GetEventCheckinQueryErrors, GetEventCheckinQueryResponse, GetEventCheckinQueryResponses, GetEventCheckinResponse, GetEventCheckinResponses, GetEventInfoData, GetEventInfoError, GetEventInfoErrors, GetEventInfoResponse, GetEventInfoResponses, GetEventJoinedData, GetEventJoinedError, GetEventJoinedErrors, GetEventJoinedResponse, GetEventJoinedResponses, GetEventListData, GetEventListError, GetEventListErrors, GetEventListResponse, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdError, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponse, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoError, GetUserInfoErrors, GetUserInfoResponse, GetUserInfoResponses, GetUserListData, GetUserListError, GetUserListErrors, GetUserListResponse, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateError, PatchUserUpdateErrors, PatchUserUpdateResponse, PatchUserUpdateResponses, PostAgendaSubmitData, PostAgendaSubmitError, PostAgendaSubmitErrors, PostAgendaSubmitResponse, PostAgendaSubmitResponses, PostAuthExchangeData, PostAuthExchangeError, PostAuthExchangeErrors, PostAuthExchangeResponse, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicError, PostAuthMagicErrors, PostAuthMagicResponse, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshError, PostAuthRefreshErrors, PostAuthRefreshResponse, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenError, PostAuthTokenErrors, PostAuthTokenResponse, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitError, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponse, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinError, PostEventJoinErrors, PostEventJoinResponse, PostEventJoinResponses, PostKycQueryData, PostKycQueryError, PostKycQueryErrors, PostKycQueryResponse, PostKycQueryResponses, PostKycSessionData, PostKycSessionError, PostKycSessionErrors, PostKycSessionResponse, PostKycSessionResponses, ServiceAgendaSubmitData, ServiceAgendaSubmitResponse, ServiceAuthExchangeData, ServiceAuthExchangeResponse, ServiceAuthMagicData, ServiceAuthMagicResponse, ServiceAuthRefreshData, ServiceAuthTokenData, ServiceAuthTokenResponse, ServiceEventAttendanceListResponse, ServiceEventCheckinQueryResponse, ServiceEventCheckinResponse, ServiceEventCheckinSubmitData, ServiceEventEventJoinData, ServiceEventEventJoinResponse, ServiceKycKycQueryData, ServiceKycKycQueryResponse, ServiceKycKycSessionData, ServiceKycKycSessionResponse, ServiceUserUserInfoData, UtilsRespStatus } from './types.gen';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import type { Client, Options as Options2, TDataShape } from './client';
|
import type { Client, Options as Options2, TDataShape } from './client';
|
||||||
import { client } from './client.gen';
|
import { client } from './client.gen';
|
||||||
import type { GetAuthRedirectData, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceErrors, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryErrors, GetEventCheckinQueryResponses, GetEventCheckinResponses, GetEventInfoData, GetEventInfoErrors, GetEventInfoResponses, GetEventListData, GetEventListErrors, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserListData, GetUserListErrors, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateErrors, PatchUserUpdateResponses, PostAuthExchangeData, PostAuthExchangeErrors, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicErrors, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshErrors, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenErrors, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinErrors, PostEventJoinResponses, PostKycQueryData, PostKycQueryErrors, PostKycQueryResponses, PostKycSessionData, PostKycSessionErrors, PostKycSessionResponses } from './types.gen';
|
import type { GetAuthRedirectData, GetAuthRedirectErrors, GetEventAttendanceData, GetEventAttendanceErrors, GetEventAttendanceResponses, GetEventCheckinData, GetEventCheckinErrors, GetEventCheckinQueryData, GetEventCheckinQueryErrors, GetEventCheckinQueryResponses, GetEventCheckinResponses, GetEventInfoData, GetEventInfoErrors, GetEventInfoResponses, GetEventJoinedData, GetEventJoinedErrors, GetEventJoinedResponses, GetEventListData, GetEventListErrors, GetEventListResponses, GetUserInfoByUserIdData, GetUserInfoByUserIdErrors, GetUserInfoByUserIdResponses, GetUserInfoData, GetUserInfoErrors, GetUserInfoResponses, GetUserListData, GetUserListErrors, GetUserListResponses, PatchUserUpdateData, PatchUserUpdateErrors, PatchUserUpdateResponses, PostAgendaSubmitData, PostAgendaSubmitErrors, PostAgendaSubmitResponses, PostAuthExchangeData, PostAuthExchangeErrors, PostAuthExchangeResponses, PostAuthMagicData, PostAuthMagicErrors, PostAuthMagicResponses, PostAuthRefreshData, PostAuthRefreshErrors, PostAuthRefreshResponses, PostAuthTokenData, PostAuthTokenErrors, PostAuthTokenResponses, PostEventCheckinSubmitData, PostEventCheckinSubmitErrors, PostEventCheckinSubmitResponses, PostEventJoinData, PostEventJoinErrors, PostEventJoinResponses, PostKycQueryData, PostKycQueryErrors, PostKycQueryResponses, PostKycSessionData, PostKycSessionErrors, PostKycSessionResponses } from './types.gen';
|
||||||
|
|
||||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
||||||
/**
|
/**
|
||||||
@@ -18,6 +18,20 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|||||||
meta?: Record<string, unknown>;
|
meta?: Record<string, unknown>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit Agenda
|
||||||
|
*
|
||||||
|
* Creates a new agenda item for a specific attendance record.
|
||||||
|
*/
|
||||||
|
export const postAgendaSubmit = <ThrowOnError extends boolean = false>(options: Options<PostAgendaSubmitData, ThrowOnError>) => (options.client ?? client).post<PostAgendaSubmitResponses, PostAgendaSubmitErrors, ThrowOnError>({
|
||||||
|
url: '/agenda/submit',
|
||||||
|
...options,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
...options.headers
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exchange Auth Code
|
* Exchange Auth Code
|
||||||
*
|
*
|
||||||
@@ -137,12 +151,19 @@ export const postEventJoin = <ThrowOnError extends boolean = false>(options: Opt
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Joined Events
|
||||||
|
*
|
||||||
|
* Fetches a list of events where the authenticated user is a participant. Supports pagination.
|
||||||
|
*/
|
||||||
|
export const getEventJoined = <ThrowOnError extends boolean = false>(options?: Options<GetEventJoinedData, ThrowOnError>) => (options?.client ?? client).get<GetEventJoinedResponses, GetEventJoinedErrors, ThrowOnError>({ url: '/event/joined', ...options });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List Events
|
* List Events
|
||||||
*
|
*
|
||||||
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
* Fetches a list of events with support for pagination via limit and offset. Data is retrieved directly from the database for consistency.
|
||||||
*/
|
*/
|
||||||
export const getEventList = <ThrowOnError extends boolean = false>(options: Options<GetEventListData, ThrowOnError>) => (options.client ?? client).get<GetEventListResponses, GetEventListErrors, ThrowOnError>({ url: '/event/list', ...options });
|
export const getEventList = <ThrowOnError extends boolean = false>(options?: Options<GetEventListData, ThrowOnError>) => (options?.client ?? client).get<GetEventListResponses, GetEventListErrors, ThrowOnError>({ url: '/event/list', ...options });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query KYC Status
|
* Query KYC Status
|
||||||
@@ -177,7 +198,7 @@ export const postKycSession = <ThrowOnError extends boolean = false>(options: Op
|
|||||||
*
|
*
|
||||||
* Fetches the complete profile data for the user associated with the provided session/token.
|
* Fetches the complete profile data for the user associated with the provided session/token.
|
||||||
*/
|
*/
|
||||||
export const getUserInfo = <ThrowOnError extends boolean = false>(options: Options<GetUserInfoData, ThrowOnError>) => (options.client ?? client).get<GetUserInfoResponses, GetUserInfoErrors, ThrowOnError>({ url: '/user/info', ...options });
|
export const getUserInfo = <ThrowOnError extends boolean = false>(options?: Options<GetUserInfoData, ThrowOnError>) => (options?.client ?? client).get<GetUserInfoResponses, GetUserInfoErrors, ThrowOnError>({ url: '/user/info', ...options });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Other User Information
|
* Get Other User Information
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
export type ClientOptions = {
|
export type ClientOptions = {
|
||||||
baseUrl: 'http://localhost:8000/api/v1' | 'https://localhost:8000/api/v1' | (string & {});
|
baseUrl: 'http://localhost:8000/app/api/v1' | 'https://localhost:8000/app/api/v1' | (string & {});
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DataEventIndexDoc = {
|
export type DataEventIndexDoc = {
|
||||||
@@ -28,6 +28,16 @@ export type DataUserIndexDoc = {
|
|||||||
username?: string;
|
username?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ServiceAgendaSubmitData = {
|
||||||
|
description?: string;
|
||||||
|
event_id?: string;
|
||||||
|
name?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ServiceAgendaSubmitResponse = {
|
||||||
|
agenda_id?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type ServiceAuthExchangeData = {
|
export type ServiceAuthExchangeData = {
|
||||||
client_id?: string;
|
client_id?: string;
|
||||||
redirect_uri?: string;
|
redirect_uri?: string;
|
||||||
@@ -88,6 +98,10 @@ export type ServiceEventEventJoinData = {
|
|||||||
kyc_id?: string;
|
kyc_id?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ServiceEventEventJoinResponse = {
|
||||||
|
attendance_id?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type ServiceKycKycQueryData = {
|
export type ServiceKycKycQueryData = {
|
||||||
kyc_id?: string;
|
kyc_id?: string;
|
||||||
};
|
};
|
||||||
@@ -138,17 +152,53 @@ export type UtilsRespStatus = {
|
|||||||
status?: string;
|
status?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PostAgendaSubmitData = {
|
||||||
|
/**
|
||||||
|
* Agenda Submission Data
|
||||||
|
*/
|
||||||
|
body: ServiceAgendaSubmitData;
|
||||||
|
path?: never;
|
||||||
|
query?: never;
|
||||||
|
url: '/agenda/submit';
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostAgendaSubmitErrors = {
|
||||||
|
/**
|
||||||
|
* Invalid Input
|
||||||
|
*/
|
||||||
|
400: UtilsRespStatus & {
|
||||||
|
data?: {
|
||||||
|
[key: string]: unknown;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Internal Server Error
|
||||||
|
*/
|
||||||
|
500: UtilsRespStatus & {
|
||||||
|
data?: {
|
||||||
|
[key: string]: unknown;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostAgendaSubmitError = PostAgendaSubmitErrors[keyof PostAgendaSubmitErrors];
|
||||||
|
|
||||||
|
export type PostAgendaSubmitResponses = {
|
||||||
|
/**
|
||||||
|
* OK
|
||||||
|
*/
|
||||||
|
200: UtilsRespStatus & {
|
||||||
|
data?: ServiceAgendaSubmitResponse;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostAgendaSubmitResponse = PostAgendaSubmitResponses[keyof PostAgendaSubmitResponses];
|
||||||
|
|
||||||
export type PostAuthExchangeData = {
|
export type PostAuthExchangeData = {
|
||||||
/**
|
/**
|
||||||
* Exchange Request Credentials
|
* Exchange Request Credentials
|
||||||
*/
|
*/
|
||||||
body: ServiceAuthExchangeData;
|
body: ServiceAuthExchangeData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/auth/exchange';
|
url: '/auth/exchange';
|
||||||
@@ -199,12 +249,6 @@ export type PostAuthMagicData = {
|
|||||||
* Magic Link Request Data
|
* Magic Link Request Data
|
||||||
*/
|
*/
|
||||||
body: ServiceAuthMagicData;
|
body: ServiceAuthMagicData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/auth/magic';
|
url: '/auth/magic';
|
||||||
@@ -308,12 +352,6 @@ export type PostAuthRefreshData = {
|
|||||||
* Refresh Token Body
|
* Refresh Token Body
|
||||||
*/
|
*/
|
||||||
body: ServiceAuthRefreshData;
|
body: ServiceAuthRefreshData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/auth/refresh';
|
url: '/auth/refresh';
|
||||||
@@ -364,12 +402,6 @@ export type PostAuthTokenData = {
|
|||||||
* Token Request Body
|
* Token Request Body
|
||||||
*/
|
*/
|
||||||
body: ServiceAuthTokenData;
|
body: ServiceAuthTokenData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/auth/token';
|
url: '/auth/token';
|
||||||
@@ -417,12 +449,6 @@ export type PostAuthTokenResponse = PostAuthTokenResponses[keyof PostAuthTokenRe
|
|||||||
|
|
||||||
export type GetEventAttendanceData = {
|
export type GetEventAttendanceData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query: {
|
query: {
|
||||||
/**
|
/**
|
||||||
@@ -480,6 +506,10 @@ export type GetEventCheckinData = {
|
|||||||
* latest
|
* latest
|
||||||
*/
|
*/
|
||||||
'X-Api-Version': string;
|
'X-Api-Version': string;
|
||||||
|
/**
|
||||||
|
* Bearer token
|
||||||
|
*/
|
||||||
|
Authorization: string;
|
||||||
};
|
};
|
||||||
path?: never;
|
path?: never;
|
||||||
query: {
|
query: {
|
||||||
@@ -580,6 +610,16 @@ export type PostEventCheckinSubmitData = {
|
|||||||
* Checkin Code Data
|
* Checkin Code Data
|
||||||
*/
|
*/
|
||||||
body: ServiceEventCheckinSubmitData;
|
body: ServiceEventCheckinSubmitData;
|
||||||
|
headers: {
|
||||||
|
/**
|
||||||
|
* latest
|
||||||
|
*/
|
||||||
|
'X-Api-Version': string;
|
||||||
|
/**
|
||||||
|
* Bearer token
|
||||||
|
*/
|
||||||
|
Authorization: string;
|
||||||
|
};
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/event/checkin/submit';
|
url: '/event/checkin/submit';
|
||||||
@@ -613,12 +653,6 @@ export type PostEventCheckinSubmitResponse = PostEventCheckinSubmitResponses[key
|
|||||||
|
|
||||||
export type GetEventInfoData = {
|
export type GetEventInfoData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query: {
|
query: {
|
||||||
/**
|
/**
|
||||||
@@ -682,12 +716,6 @@ export type PostEventJoinData = {
|
|||||||
* Event Join Details (UserId and EventId are required)
|
* Event Join Details (UserId and EventId are required)
|
||||||
*/
|
*/
|
||||||
body: ServiceEventEventJoinData;
|
body: ServiceEventEventJoinData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/event/join';
|
url: '/event/join';
|
||||||
@@ -735,22 +763,70 @@ export type PostEventJoinResponses = {
|
|||||||
* Successfully joined the event
|
* Successfully joined the event
|
||||||
*/
|
*/
|
||||||
200: UtilsRespStatus & {
|
200: UtilsRespStatus & {
|
||||||
|
data?: ServiceEventEventJoinResponse;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PostEventJoinResponse = PostEventJoinResponses[keyof PostEventJoinResponses];
|
||||||
|
|
||||||
|
export type GetEventJoinedData = {
|
||||||
|
body?: never;
|
||||||
|
path?: never;
|
||||||
|
query?: {
|
||||||
|
/**
|
||||||
|
* Maximum number of events to return (default 20)
|
||||||
|
*/
|
||||||
|
limit?: number;
|
||||||
|
/**
|
||||||
|
* Number of events to skip
|
||||||
|
*/
|
||||||
|
offset?: number;
|
||||||
|
};
|
||||||
|
url: '/event/joined';
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetEventJoinedErrors = {
|
||||||
|
/**
|
||||||
|
* Invalid Input
|
||||||
|
*/
|
||||||
|
400: UtilsRespStatus & {
|
||||||
|
data?: {
|
||||||
|
[key: string]: unknown;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Unauthorized
|
||||||
|
*/
|
||||||
|
401: UtilsRespStatus & {
|
||||||
|
data?: {
|
||||||
|
[key: string]: unknown;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Internal Server Error
|
||||||
|
*/
|
||||||
|
500: UtilsRespStatus & {
|
||||||
data?: {
|
data?: {
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PostEventJoinResponse = PostEventJoinResponses[keyof PostEventJoinResponses];
|
export type GetEventJoinedError = GetEventJoinedErrors[keyof GetEventJoinedErrors];
|
||||||
|
|
||||||
|
export type GetEventJoinedResponses = {
|
||||||
|
/**
|
||||||
|
* Successful retrieval of joined events
|
||||||
|
*/
|
||||||
|
200: UtilsRespStatus & {
|
||||||
|
data?: Array<DataEventIndexDoc>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GetEventJoinedResponse = GetEventJoinedResponses[keyof GetEventJoinedResponses];
|
||||||
|
|
||||||
export type GetEventListData = {
|
export type GetEventListData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: {
|
query?: {
|
||||||
/**
|
/**
|
||||||
@@ -810,12 +886,6 @@ export type PostKycQueryData = {
|
|||||||
* KYC query data (KycId)
|
* KYC query data (KycId)
|
||||||
*/
|
*/
|
||||||
body: ServiceKycKycQueryData;
|
body: ServiceKycKycQueryData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/kyc/query';
|
url: '/kyc/query';
|
||||||
@@ -866,12 +936,6 @@ export type PostKycSessionData = {
|
|||||||
* KYC session data (Type and Base64 Identity)
|
* KYC session data (Type and Base64 Identity)
|
||||||
*/
|
*/
|
||||||
body: ServiceKycKycSessionData;
|
body: ServiceKycKycSessionData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/kyc/session';
|
url: '/kyc/session';
|
||||||
@@ -919,12 +983,6 @@ export type PostKycSessionResponse = PostKycSessionResponses[keyof PostKycSessio
|
|||||||
|
|
||||||
export type GetUserInfoData = {
|
export type GetUserInfoData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/user/info';
|
url: '/user/info';
|
||||||
@@ -972,12 +1030,6 @@ export type GetUserInfoResponse = GetUserInfoResponses[keyof GetUserInfoResponse
|
|||||||
|
|
||||||
export type GetUserInfoByUserIdData = {
|
export type GetUserInfoByUserIdData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path: {
|
path: {
|
||||||
/**
|
/**
|
||||||
* Other user id
|
* Other user id
|
||||||
@@ -1038,12 +1090,6 @@ export type GetUserInfoByUserIdResponse = GetUserInfoByUserIdResponses[keyof Get
|
|||||||
|
|
||||||
export type GetUserListData = {
|
export type GetUserListData = {
|
||||||
body?: never;
|
body?: never;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query: {
|
query: {
|
||||||
/**
|
/**
|
||||||
@@ -1103,12 +1149,6 @@ export type PatchUserUpdateData = {
|
|||||||
* Updated User Profile Data
|
* Updated User Profile Data
|
||||||
*/
|
*/
|
||||||
body: ServiceUserUserInfoData;
|
body: ServiceUserUserInfoData;
|
||||||
headers: {
|
|
||||||
/**
|
|
||||||
* latest
|
|
||||||
*/
|
|
||||||
'X-Api-Version': string;
|
|
||||||
};
|
|
||||||
path?: never;
|
path?: never;
|
||||||
query?: never;
|
query?: never;
|
||||||
url: '/user/update';
|
url: '/user/update';
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ export const zDataUserIndexDoc = z.object({
|
|||||||
username: z.string().optional()
|
username: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const zServiceAgendaSubmitData = z.object({
|
||||||
|
description: z.string().optional(),
|
||||||
|
event_id: z.string().optional(),
|
||||||
|
name: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
export const zServiceAgendaSubmitResponse = z.object({
|
||||||
|
agenda_id: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
export const zServiceAuthExchangeData = z.object({
|
export const zServiceAuthExchangeData = z.object({
|
||||||
client_id: z.string().optional(),
|
client_id: z.string().optional(),
|
||||||
redirect_uri: z.string().optional(),
|
redirect_uri: z.string().optional(),
|
||||||
@@ -79,6 +89,10 @@ export const zServiceEventEventJoinData = z.object({
|
|||||||
kyc_id: z.string().optional()
|
kyc_id: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const zServiceEventEventJoinResponse = z.object({
|
||||||
|
attendance_id: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
export const zServiceKycKycQueryData = z.object({
|
export const zServiceKycKycQueryData = z.object({
|
||||||
kyc_id: z.string().optional()
|
kyc_id: z.string().optional()
|
||||||
});
|
});
|
||||||
@@ -124,13 +138,23 @@ export const zUtilsRespStatus = z.object({
|
|||||||
status: z.string().optional()
|
status: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const zPostAgendaSubmitData = z.object({
|
||||||
|
body: zServiceAgendaSubmitData,
|
||||||
|
path: z.never().optional(),
|
||||||
|
query: z.never().optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OK
|
||||||
|
*/
|
||||||
|
export const zPostAgendaSubmitResponse = zUtilsRespStatus.and(z.object({
|
||||||
|
data: zServiceAgendaSubmitResponse.optional()
|
||||||
|
}));
|
||||||
|
|
||||||
export const zPostAuthExchangeData = z.object({
|
export const zPostAuthExchangeData = z.object({
|
||||||
body: zServiceAuthExchangeData,
|
body: zServiceAuthExchangeData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,10 +167,7 @@ export const zPostAuthExchangeResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostAuthMagicData = z.object({
|
export const zPostAuthMagicData = z.object({
|
||||||
body: zServiceAuthMagicData,
|
body: zServiceAuthMagicData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,10 +191,7 @@ export const zGetAuthRedirectData = z.object({
|
|||||||
export const zPostAuthRefreshData = z.object({
|
export const zPostAuthRefreshData = z.object({
|
||||||
body: zServiceAuthRefreshData,
|
body: zServiceAuthRefreshData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,10 +204,7 @@ export const zPostAuthRefreshResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostAuthTokenData = z.object({
|
export const zPostAuthTokenData = z.object({
|
||||||
body: zServiceAuthTokenData,
|
body: zServiceAuthTokenData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -204,9 +219,6 @@ export const zGetEventAttendanceData = z.object({
|
|||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.object({
|
query: z.object({
|
||||||
event_id: z.string()
|
event_id: z.string()
|
||||||
}),
|
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -224,7 +236,8 @@ export const zGetEventCheckinData = z.object({
|
|||||||
event_id: z.string()
|
event_id: z.string()
|
||||||
}),
|
}),
|
||||||
headers: z.object({
|
headers: z.object({
|
||||||
'X-Api-Version': z.string()
|
'X-Api-Version': z.string(),
|
||||||
|
Authorization: z.string()
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -253,7 +266,11 @@ export const zGetEventCheckinQueryResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostEventCheckinSubmitData = z.object({
|
export const zPostEventCheckinSubmitData = z.object({
|
||||||
body: zServiceEventCheckinSubmitData,
|
body: zServiceEventCheckinSubmitData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional()
|
query: z.never().optional(),
|
||||||
|
headers: z.object({
|
||||||
|
'X-Api-Version': z.string(),
|
||||||
|
Authorization: z.string()
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -268,9 +285,6 @@ export const zGetEventInfoData = z.object({
|
|||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.object({
|
query: z.object({
|
||||||
event_id: z.string()
|
event_id: z.string()
|
||||||
}),
|
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -284,17 +298,30 @@ export const zGetEventInfoResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostEventJoinData = z.object({
|
export const zPostEventJoinData = z.object({
|
||||||
body: zServiceEventEventJoinData,
|
body: zServiceEventEventJoinData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Successfully joined the event
|
* Successfully joined the event
|
||||||
*/
|
*/
|
||||||
export const zPostEventJoinResponse = zUtilsRespStatus.and(z.object({
|
export const zPostEventJoinResponse = zUtilsRespStatus.and(z.object({
|
||||||
data: z.record(z.unknown()).optional()
|
data: zServiceEventEventJoinResponse.optional()
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const zGetEventJoinedData = z.object({
|
||||||
|
body: z.never().optional(),
|
||||||
|
path: z.never().optional(),
|
||||||
|
query: z.object({
|
||||||
|
limit: z.number().int().optional(),
|
||||||
|
offset: z.number().int().optional()
|
||||||
|
}).optional()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Successful retrieval of joined events
|
||||||
|
*/
|
||||||
|
export const zGetEventJoinedResponse = zUtilsRespStatus.and(z.object({
|
||||||
|
data: z.array(zDataEventIndexDoc).optional()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const zGetEventListData = z.object({
|
export const zGetEventListData = z.object({
|
||||||
@@ -303,10 +330,7 @@ export const zGetEventListData = z.object({
|
|||||||
query: z.object({
|
query: z.object({
|
||||||
limit: z.number().int().optional(),
|
limit: z.number().int().optional(),
|
||||||
offset: z.number().int().optional()
|
offset: z.number().int().optional()
|
||||||
}).optional(),
|
}).optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,10 +343,7 @@ export const zGetEventListResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostKycQueryData = z.object({
|
export const zPostKycQueryData = z.object({
|
||||||
body: zServiceKycKycQueryData,
|
body: zServiceKycKycQueryData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -335,10 +356,7 @@ export const zPostKycQueryResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPostKycSessionData = z.object({
|
export const zPostKycSessionData = z.object({
|
||||||
body: zServiceKycKycSessionData,
|
body: zServiceKycKycSessionData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -351,10 +369,7 @@ export const zPostKycSessionResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zGetUserInfoData = z.object({
|
export const zGetUserInfoData = z.object({
|
||||||
body: z.never().optional(),
|
body: z.never().optional(),
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -369,10 +384,7 @@ export const zGetUserInfoByUserIdData = z.object({
|
|||||||
path: z.object({
|
path: z.object({
|
||||||
user_id: z.string()
|
user_id: z.string()
|
||||||
}),
|
}),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,9 +400,6 @@ export const zGetUserListData = z.object({
|
|||||||
query: z.object({
|
query: z.object({
|
||||||
limit: z.string().optional(),
|
limit: z.string().optional(),
|
||||||
offset: z.string()
|
offset: z.string()
|
||||||
}),
|
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -404,10 +413,7 @@ export const zGetUserListResponse = zUtilsRespStatus.and(z.object({
|
|||||||
export const zPatchUserUpdateData = z.object({
|
export const zPatchUserUpdateData = z.object({
|
||||||
body: zServiceUserUserInfoData,
|
body: zServiceUserUserInfoData,
|
||||||
path: z.never().optional(),
|
path: z.never().optional(),
|
||||||
query: z.never().optional(),
|
query: z.never().optional()
|
||||||
headers: z.object({
|
|
||||||
'X-Api-Version': z.string()
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,14 +3,19 @@ import PlaceholderImage from '@/assets/event-placeholder.png';
|
|||||||
import { useGetEvents } from '@/hooks/data/useGetEvents';
|
import { useGetEvents } from '@/hooks/data/useGetEvents';
|
||||||
import { Button } from '../ui/button';
|
import { Button } from '../ui/button';
|
||||||
import { DialogTrigger } from '../ui/dialog';
|
import { DialogTrigger } from '../ui/dialog';
|
||||||
|
import { EventGridSkeleton } from './event-grid.skeleton';
|
||||||
import { EventGridView } from './event-grid.view';
|
import { EventGridView } from './event-grid.view';
|
||||||
import { KycDialogContainer } from './kyc/kyc.dialog.container';
|
import { KycDialogContainer } from './kyc/kyc.dialog.container';
|
||||||
|
|
||||||
export function EventGridContainer() {
|
export function EventGridContainer() {
|
||||||
const { data, isLoading } = useGetEvents();
|
const { data, isLoading } = useGetEvents();
|
||||||
const allEvents: EventInfo[] = isLoading
|
|
||||||
? []
|
return (
|
||||||
: data.pages.flatMap(page => page.data ?? []).map(it => ({
|
isLoading
|
||||||
|
? <EventGridSkeleton />
|
||||||
|
: (
|
||||||
|
<EventGridView
|
||||||
|
events={data.pages.flatMap(page => page.data ?? []).map(it => ({
|
||||||
type: it.type! as EventInfo['type'],
|
type: it.type! as EventInfo['type'],
|
||||||
eventId: it.event_id!,
|
eventId: it.event_id!,
|
||||||
isJoined: it.is_joined!,
|
isJoined: it.is_joined!,
|
||||||
@@ -20,11 +25,7 @@ export function EventGridContainer() {
|
|||||||
description: it.description!,
|
description: it.description!,
|
||||||
startTime: new Date(it.start_time!),
|
startTime: new Date(it.start_time!),
|
||||||
endTime: new Date(it.end_time!),
|
endTime: new Date(it.end_time!),
|
||||||
} satisfies EventInfo));
|
} satisfies EventInfo))}
|
||||||
|
|
||||||
return (
|
|
||||||
<EventGridView
|
|
||||||
events={allEvents}
|
|
||||||
footer={eventInfo => (eventInfo.isJoined
|
footer={eventInfo => (eventInfo.isJoined
|
||||||
? <Button className="w-full" disabled>已加入</Button>
|
? <Button className="w-full" disabled>已加入</Button>
|
||||||
: (
|
: (
|
||||||
@@ -36,5 +37,6 @@ export function EventGridContainer() {
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
16
client/cms/src/components/events/event-grid.error.tsx
Normal file
16
client/cms/src/components/events/event-grid.error.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { FileExclamationPoint } from 'lucide-react';
|
||||||
|
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '../ui/empty';
|
||||||
|
|
||||||
|
export function EventGridError() {
|
||||||
|
return (
|
||||||
|
<Empty className="h-full">
|
||||||
|
<EmptyHeader>
|
||||||
|
<EmptyMedia variant="icon">
|
||||||
|
<FileExclamationPoint />
|
||||||
|
</EmptyMedia>
|
||||||
|
<EmptyTitle>活动列表加载失败</EmptyTitle>
|
||||||
|
<EmptyDescription>前面的区域 以后再来探索吧</EmptyDescription>
|
||||||
|
</EmptyHeader>
|
||||||
|
</Empty>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import { EventCardSkeleton } from './event-card.skeleton';
|
|||||||
export function EventGridSkeleton() {
|
export function EventGridSkeleton() {
|
||||||
return (
|
return (
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||||
{Array.from({ length: 8 }).map((_, i) => (
|
{Array.from({ length: 4 }).map((_, i) => (
|
||||||
// eslint-disable-next-line react/no-array-index-key
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<EventCardSkeleton key={i} />
|
<EventCardSkeleton key={i} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function EventGridView({ events, footer }: { events: EventInfo[]; footer:
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{events.length > 0 && (
|
{events.length > 0 && (
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4 h-full">
|
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4">
|
||||||
{events.map(event => (
|
{events.map(event => (
|
||||||
<EventCardView key={event.eventId} eventInfo={event} actionFooter={footer(event)} />
|
<EventCardView key={event.eventId} eventInfo={event} actionFooter={footer(event)} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { useStore } from 'zustand';
|
|||||||
import { postEventJoin, postKycQuery } from '@/client';
|
import { postEventJoin, postKycQuery } from '@/client';
|
||||||
import { getEventListInfiniteQueryKey } from '@/client/@tanstack/react-query.gen';
|
import { getEventListInfiniteQueryKey } from '@/client/@tanstack/react-query.gen';
|
||||||
import { useCreateKycSession } from '@/hooks/data/useCreateKycSession';
|
import { useCreateKycSession } from '@/hooks/data/useCreateKycSession';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { KycFailedDialogView } from './kyc-failed.dialog.view';
|
import { KycFailedDialogView } from './kyc-failed.dialog.view';
|
||||||
import { KycMethodSelectionDialogView } from './kyc-method-selection.dialog.view';
|
import { KycMethodSelectionDialogView } from './kyc-method-selection.dialog.view';
|
||||||
import { KycPendingDialogView } from './kyc-pending.dialog.view';
|
import { KycPendingDialogView } from './kyc-pending.dialog.view';
|
||||||
@@ -30,7 +29,6 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin:
|
|||||||
await postEventJoin({
|
await postEventJoin({
|
||||||
signal: abortSignal,
|
signal: abortSignal,
|
||||||
body: { event_id: eventId, kyc_id: kycId },
|
body: { event_id: eventId, kyc_id: kycId },
|
||||||
headers: ver('20260205'),
|
|
||||||
});
|
});
|
||||||
setStage('success');
|
setStage('success');
|
||||||
}
|
}
|
||||||
@@ -71,7 +69,6 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin:
|
|||||||
const { data } = await postKycQuery({
|
const { data } = await postKycQuery({
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
body: { kyc_id: store.getState().kycId! },
|
body: { kyc_id: store.getState().kycId! },
|
||||||
headers: ver('20260205'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const status = data?.data?.status;
|
const status = data?.data?.status;
|
||||||
@@ -112,7 +109,7 @@ export function KycDialogContainer({ eventIdToJoin, children }: { eventIdToJoin:
|
|||||||
onOpenChange={(open) => {
|
onOpenChange={(open) => {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
void queryClient.invalidateQueries({
|
void queryClient.invalidateQueries({
|
||||||
queryKey: getEventListInfiniteQueryKey({ query: {}, headers: ver('20260205') }),
|
queryKey: getEventListInfiniteQueryKey({ query: {} }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setIsDialogOpen(open);
|
setIsDialogOpen(open);
|
||||||
|
|||||||
18
client/cms/src/components/global.error.tsx
Normal file
18
client/cms/src/components/global.error.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import type { RawError } from '@/lib/types';
|
||||||
|
import { TriangleAlert } from 'lucide-react';
|
||||||
|
import { isRawError } from '@/lib/types';
|
||||||
|
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './ui/empty';
|
||||||
|
|
||||||
|
export function GlobalError({ error }: { error: Error | RawError }) {
|
||||||
|
return (
|
||||||
|
<Empty className="h-screen w-full">
|
||||||
|
<EmptyHeader>
|
||||||
|
<EmptyMedia variant="icon">
|
||||||
|
<TriangleAlert />
|
||||||
|
</EmptyMedia>
|
||||||
|
<EmptyTitle>出错了</EmptyTitle>
|
||||||
|
<EmptyDescription>{isRawError(error) ? error.error_id : error.message}</EmptyDescription>
|
||||||
|
</EmptyHeader>
|
||||||
|
</Empty>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
} from '@/components/ui/field';
|
} from '@/components/ui/field';
|
||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { useGetMagicLink } from '@/hooks/data/useGetMagicLink';
|
import { useGetMagicLink } from '@/hooks/data/useGetMagicLink';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
export function LoginForm({
|
export function LoginForm({
|
||||||
@@ -33,7 +32,7 @@ export function LoginForm({
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const formData = new FormData(formRef.current!);
|
const formData = new FormData(formRef.current!);
|
||||||
const email = formData.get('email')! as string;
|
const email = formData.get('email')! as string;
|
||||||
mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams }, headers: ver('20260205') }).then(() => {
|
mutateAsync({ body: { email, turnstile_token: token!, ...oauthParams } }).then(() => {
|
||||||
void navigate({ to: '/magicLinkSent', search: { email } });
|
void navigate({ to: '/magicLinkSent', search: { email } });
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { ServiceUserUserInfoData } from '@/client';
|
import type { ServiceUserUserInfoData } from '@/client';
|
||||||
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { EditProfileDialogView } from './edit-profile.dialog.view';
|
import { EditProfileDialogView } from './edit-profile.dialog.view';
|
||||||
|
|
||||||
export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfoData }) {
|
export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfoData }) {
|
||||||
@@ -9,7 +8,7 @@ export function EditProfileDialogContainer({ data }: { data: ServiceUserUserInfo
|
|||||||
<EditProfileDialogView
|
<EditProfileDialogView
|
||||||
user={data}
|
user={data}
|
||||||
updateProfile={async (data) => {
|
updateProfile={async (data) => {
|
||||||
await mutateAsync({ body: data, headers: ver('20260205') });
|
await mutateAsync({ body: data });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
import { useUpdateUser } from '@/hooks/data/useUpdateUser';
|
||||||
import { useOtherUserInfo } from '@/hooks/data/useUserInfo';
|
import { useOtherUserInfo } from '@/hooks/data/useUserInfo';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { utf8ToBase64 } from '@/lib/utils';
|
import { utf8ToBase64 } from '@/lib/utils';
|
||||||
import { ProfileView } from './profile.view';
|
import { ProfileView } from './profile.view';
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ export function ProfileContainer({ userId }: { userId: string }) {
|
|||||||
<ProfileView
|
<ProfileView
|
||||||
user={data.data!}
|
user={data.data!}
|
||||||
onSaveBio={async (bio) => {
|
onSaveBio={async (bio) => {
|
||||||
await mutateAsync({ body: { bio: utf8ToBase64(bio) }, headers: ver('20260205') });
|
await mutateAsync({ body: { bio: utf8ToBase64(bio) } });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,30 +1,16 @@
|
|||||||
import { Mail } from 'lucide-react';
|
import { UserLock } from 'lucide-react';
|
||||||
import { Skeleton } from '../ui/skeleton';
|
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '../ui/empty';
|
||||||
|
|
||||||
export function ProfileError({ reason }: { reason: string }) {
|
export function ProfileError({ reason }: { reason: string }) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col justify-center w-full lg:w-auto h-full lg:h-auto lg:flex-row lg:gap-8">
|
<Empty className="h-full">
|
||||||
<div className="flex w-full flex-row mt-2 lg:mt-0 lg:flex-col lg:w-max">
|
<EmptyHeader>
|
||||||
<div className="flex flex-col w-full gap-3">
|
<EmptyMedia variant="icon">
|
||||||
<div className="flex flex-col w-full gap-3">
|
<UserLock />
|
||||||
<div className="flex flex-row gap-3 w-full lg:flex-col">
|
</EmptyMedia>
|
||||||
<Skeleton className="size-16 rounded-full border-2 border-muted lg:size-64" />
|
<EmptyTitle>无法查看此个人资料</EmptyTitle>
|
||||||
<div className="flex flex-1 flex-col justify-center lg:mt-3 gap-2">
|
<EmptyDescription>{reason}</EmptyDescription>
|
||||||
<Skeleton className="w-32 h-8" />
|
</EmptyHeader>
|
||||||
<Skeleton className="w-20 h-6" />
|
</Empty>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-row gap-2 items-center text-sm px-1 lg:px-0">
|
|
||||||
<Mail className="h-4 w-4 stroke-muted-foreground" />
|
|
||||||
<Skeleton className="w-32 h-4" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Skeleton className="w-64 h-[40px]" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Skeleton className="relative rounded-md border border-muted w-full flex-1 lg:flex-auto min-h-72 lg:h-full mt-4 lg:mt-0 prose dark:prose-invert max-w-[1012px] self-center flex items-center justify-center">
|
|
||||||
{reason}
|
|
||||||
</Skeleton>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { KycSubmission } from '@/components/events/kyc/kyc.types';
|
import type { KycSubmission } from '@/components/events/kyc/kyc.types';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { postKycSessionMutation } from '@/client/@tanstack/react-query.gen';
|
import { postKycSessionMutation } from '@/client/@tanstack/react-query.gen';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { utf8ToBase64 } from '@/lib/utils';
|
import { utf8ToBase64 } from '@/lib/utils';
|
||||||
|
|
||||||
type CreateKycSessionBase64Payload = {
|
type CreateKycSessionBase64Payload = {
|
||||||
@@ -37,7 +36,6 @@ export function useCreateKycSession() {
|
|||||||
identity: payload,
|
identity: payload,
|
||||||
type: data.method,
|
type: data.method,
|
||||||
},
|
},
|
||||||
headers: ver('20260205'),
|
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import { useInfiniteQuery } from '@tanstack/react-query';
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
||||||
import { isNil } from 'lodash-es';
|
import { isNil } from 'lodash-es';
|
||||||
import { getEventListInfiniteOptions } from '@/client/@tanstack/react-query.gen';
|
import { getEventListInfiniteOptions } from '@/client/@tanstack/react-query.gen';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
|
|
||||||
export function useGetEvents() {
|
export function useGetEvents() {
|
||||||
return useInfiniteQuery({
|
return useInfiniteQuery({
|
||||||
...getEventListInfiniteOptions({
|
...getEventListInfiniteOptions({
|
||||||
query: {},
|
query: {},
|
||||||
headers: ver('20260205'),
|
|
||||||
}),
|
}),
|
||||||
initialPageParam: 0,
|
initialPageParam: 0,
|
||||||
getNextPageParam: (lastPage, allPages) => {
|
getNextPageParam: (lastPage, allPages) => {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
import type { ServiceUserUserInfoData } from '@/client';
|
import type { ServiceUserUserInfoData } from '@/client';
|
||||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import { getUserInfoByUserIdQueryKey, getUserInfoQueryKey, patchUserUpdateMutation } from '@/client/@tanstack/react-query.gen';
|
import { getUserInfoByUserIdQueryKey, getUserInfoQueryKey, patchUserUpdateMutation } from '@/client/@tanstack/react-query.gen';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
|
|
||||||
export function useUpdateUser() {
|
export function useUpdateUser() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const data: { data: ServiceUserUserInfoData | undefined } | undefined = queryClient.getQueryData(getUserInfoQueryKey({ headers: ver('20260205') }));
|
const data: { data: ServiceUserUserInfoData | undefined } | undefined = queryClient.getQueryData(getUserInfoQueryKey());
|
||||||
return useMutation({
|
return useMutation({
|
||||||
...patchUserUpdateMutation(),
|
...patchUserUpdateMutation(),
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
await queryClient.invalidateQueries({ queryKey: getUserInfoQueryKey({ headers: ver('20260205') }) });
|
await queryClient.invalidateQueries({ queryKey: getUserInfoQueryKey() });
|
||||||
if ((data?.data?.user_id) != null) {
|
if ((data?.data?.user_id) != null) {
|
||||||
await queryClient.invalidateQueries({ queryKey: getUserInfoByUserIdQueryKey({ path: { user_id: data.data.user_id }, headers: ver('20260205') }) });
|
await queryClient.invalidateQueries({ queryKey: getUserInfoByUserIdQueryKey({ path: { user_id: data.data.user_id } }) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,18 +3,17 @@ import {
|
|||||||
getUserInfoByUserIdOptions,
|
getUserInfoByUserIdOptions,
|
||||||
getUserInfoOptions,
|
getUserInfoOptions,
|
||||||
} from '@/client/@tanstack/react-query.gen';
|
} from '@/client/@tanstack/react-query.gen';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
|
|
||||||
export function useUserInfo() {
|
export function useUserInfo() {
|
||||||
return useSuspenseQuery({
|
return useSuspenseQuery({
|
||||||
...getUserInfoOptions({ headers: ver('20260205') }),
|
...getUserInfoOptions(),
|
||||||
staleTime: 10 * 60 * 1000,
|
staleTime: 10 * 60 * 1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useOtherUserInfo(userId: string) {
|
export function useOtherUserInfo(userId: string) {
|
||||||
return useSuspenseQuery({
|
return useSuspenseQuery({
|
||||||
...getUserInfoByUserIdOptions({ path: { user_id: userId }, headers: ver('20260205') }),
|
...getUserInfoByUserIdOptions({ path: { user_id: userId } }),
|
||||||
staleTime: 10 * 60 * 1000,
|
staleTime: 10 * 60 * 1000,
|
||||||
retry: (_failureCount, error) => error.code !== 403,
|
retry: (_failureCount, error) => error.code !== 403,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { ServiceAuthTokenResponse } from '@/client';
|
import type { ServiceAuthTokenResponse } from '@/client';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { postAuthRefresh } from '@/client';
|
import { postAuthRefresh } from '@/client';
|
||||||
import { ver } from './apiVersion';
|
|
||||||
import { router } from './router';
|
import { router } from './router';
|
||||||
|
|
||||||
const ACCESS_TOKEN_LOCALSTORAGE_KEY = 'token';
|
const ACCESS_TOKEN_LOCALSTORAGE_KEY = 'token';
|
||||||
@@ -41,7 +40,6 @@ export async function doRefreshToken(refreshToken: string): Promise<ServiceAuthT
|
|||||||
body: {
|
body: {
|
||||||
refresh_token: refreshToken,
|
refresh_token: refreshToken,
|
||||||
},
|
},
|
||||||
headers: ver('20260205'),
|
|
||||||
});
|
});
|
||||||
return data?.data;
|
return data?.data;
|
||||||
}
|
}
|
||||||
|
|||||||
16
client/cms/src/lib/types.ts
Normal file
16
client/cms/src/lib/types.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
export interface RawError {
|
||||||
|
code: number;
|
||||||
|
status: string;
|
||||||
|
error_id: string;
|
||||||
|
data: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isRawError(obj: any): obj is RawError {
|
||||||
|
return (
|
||||||
|
typeof obj === 'object'
|
||||||
|
&& obj !== null
|
||||||
|
&& 'code' in obj
|
||||||
|
&& 'status' in obj
|
||||||
|
&& 'error_id' in obj
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
||||||
|
import { GlobalError } from '@/components/global.error';
|
||||||
import { ThemeProvider } from '@/components/theme-provider';
|
import { ThemeProvider } from '@/components/theme-provider';
|
||||||
import { Toaster } from '@/components/ui/sonner';
|
import { Toaster } from '@/components/ui/sonner';
|
||||||
import '@/index.css';
|
import '@/index.css';
|
||||||
@@ -34,4 +35,4 @@ function RootLayout() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Route = createRootRoute({ component: RootLayout });
|
export const Route = createRootRoute({ component: RootLayout, errorComponent: ({ error }) => <GlobalError error={error} /> });
|
||||||
|
|||||||
@@ -1,28 +1,26 @@
|
|||||||
|
import type { RawError } from '@/lib/types';
|
||||||
import { createFileRoute } from '@tanstack/react-router';
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
import { Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
|
||||||
import { ProfileContainer } from '@/components/profile/profile.container';
|
import { ProfileContainer } from '@/components/profile/profile.container';
|
||||||
import { ProfileError } from '@/components/profile/profile.error';
|
import { ProfileError } from '@/components/profile/profile.error';
|
||||||
import { ProfileSkeleton } from '@/components/profile/profile.skeleton';
|
import { ProfileSkeleton } from '@/components/profile/profile.skeleton';
|
||||||
|
|
||||||
export const Route = createFileRoute('/_workbenchLayout/profile/$userId')({
|
export const Route = createFileRoute('/_workbenchLayout/profile/$userId')({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: ({ error }) => {
|
||||||
|
if ((error as unknown as RawError).code === 403)
|
||||||
|
return <ProfileError reason="用户个人资料未公开" />;
|
||||||
|
else return <ProfileError reason="获取用户个人资料失败" />;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function RouteComponent() {
|
function RouteComponent() {
|
||||||
const { userId } = Route.useParams();
|
const { userId } = Route.useParams();
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col gap-6 px-4 py-6">
|
<div className="flex h-full flex-col gap-6 px-4 py-6">
|
||||||
<ErrorBoundary fallbackRender={(error) => {
|
|
||||||
if ((error.error as { code: number }).code === 403)
|
|
||||||
return <ProfileError reason="用户个人资料未公开" />;
|
|
||||||
else return <ProfileError reason="获取用户个人资料失败" />;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Suspense fallback={<ProfileSkeleton />}>
|
<Suspense fallback={<ProfileSkeleton />}>
|
||||||
<ProfileContainer userId={userId} />
|
<ProfileContainer userId={userId} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</ErrorBoundary>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { createFileRoute, Navigate } from '@tanstack/react-router';
|
import { createFileRoute, Navigate } from '@tanstack/react-router';
|
||||||
import { Suspense } from 'react';
|
import { Suspense } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
|
||||||
import { ProfileError } from '@/components/profile/profile.error';
|
import { ProfileError } from '@/components/profile/profile.error';
|
||||||
import { ProfileSkeleton } from '@/components/profile/profile.skeleton';
|
import { ProfileSkeleton } from '@/components/profile/profile.skeleton';
|
||||||
import { useUserInfo } from '@/hooks/data/useUserInfo';
|
import { useUserInfo } from '@/hooks/data/useUserInfo';
|
||||||
|
|
||||||
export const Route = createFileRoute('/_workbenchLayout/profile/')({
|
export const Route = createFileRoute('/_workbenchLayout/profile/')({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => {
|
||||||
|
return <ProfileError reason="获取用户个人资料失败" />;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function RouteComponent() {
|
function RouteComponent() {
|
||||||
const { data } = useUserInfo();
|
const { data } = useUserInfo();
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary fallback={<ProfileError reason="获取用户个人资料失败" />}>
|
|
||||||
<Suspense fallback={<ProfileSkeleton />}>
|
<Suspense fallback={<ProfileSkeleton />}>
|
||||||
<Navigate to="/profile/$userId" params={{ userId: data.data!.user_id! }} />
|
<Navigate to="/profile/$userId" params={{ userId: data.data!.user_id! }} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</ErrorBoundary>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useEffect } from 'react';
|
|||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import { LoginForm } from '@/components/login-form';
|
import { LoginForm } from '@/components/login-form';
|
||||||
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { generateOAuthState } from '@/lib/random';
|
import { generateOAuthState } from '@/lib/random';
|
||||||
import { getAccessToken } from '@/lib/token';
|
import { getAccessToken } from '@/lib/token';
|
||||||
|
|
||||||
@@ -40,7 +39,6 @@ function RouteComponent() {
|
|||||||
redirect_uri: oauthParams.redirect_uri,
|
redirect_uri: oauthParams.redirect_uri,
|
||||||
state: oauthParams.state,
|
state: oauthParams.state,
|
||||||
},
|
},
|
||||||
headers: ver('20260205'),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [token, mutation.isIdle, mutation, oauthParams.client_id, oauthParams.redirect_uri, oauthParams.state]);
|
}, [token, mutation.isIdle, mutation, oauthParams.client_id, oauthParams.redirect_uri, oauthParams.state]);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import z from 'zod';
|
import z from 'zod';
|
||||||
import { postAuthTokenMutation } from '@/client/@tanstack/react-query.gen';
|
import { postAuthTokenMutation } from '@/client/@tanstack/react-query.gen';
|
||||||
import { ver } from '@/lib/apiVersion';
|
|
||||||
import { setAccessToken, setRefreshToken } from '@/lib/token';
|
import { setAccessToken, setRefreshToken } from '@/lib/token';
|
||||||
|
|
||||||
const tokenCodeSchema = z.object({
|
const tokenCodeSchema = z.object({
|
||||||
@@ -37,7 +36,7 @@ function RouteComponent() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (mutation.isIdle) {
|
if (mutation.isIdle) {
|
||||||
mutation.mutate({ body: { code }, headers: ver('20260205') });
|
mutation.mutate({ body: { code } });
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const Primary: Story = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Empty: Story = {
|
export const Empty: Story = {
|
||||||
decorators: [Story => <div className="h-screen">{Story()}</div>],
|
decorators: [Story => <div className="h-screen"><Story /></div>],
|
||||||
args: {
|
args: {
|
||||||
events: [],
|
events: [],
|
||||||
footer: () => <Button className="w-full">加入活动</Button>,
|
footer: () => <Button className="w-full">加入活动</Button>,
|
||||||
|
|||||||
@@ -39,10 +39,20 @@ export const Loading: Story = {
|
|||||||
|
|
||||||
export const Error: Story = {
|
export const Error: Story = {
|
||||||
render: () => <ProfileError reason="用户个人资料未公开" />,
|
render: () => <ProfileError reason="用户个人资料未公开" />,
|
||||||
|
decorators: [
|
||||||
|
Story => (
|
||||||
|
<div className="h-screen">
|
||||||
|
<Story />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
],
|
||||||
args: {
|
args: {
|
||||||
user: {
|
user: {
|
||||||
allow_public: false,
|
allow_public: false,
|
||||||
},
|
},
|
||||||
onSaveBio: async () => Promise.resolve(),
|
onSaveBio: async () => Promise.resolve(),
|
||||||
},
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: 'fullscreen',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user