feat: add CIE authentication callback page with polling mechanism for session verification
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import type {
|
||||
CieSessionResponse,
|
||||
CieStartResponse,
|
||||
CurrentUserResponse, EmailRequest, NotificationListResponse,
|
||||
OkResponse,
|
||||
OtpRequestResponse, RegisterCitizenRequest,
|
||||
@@ -82,6 +84,15 @@ export const useAuth = () => {
|
||||
const verifyOtp = (body: VerifyOtpRequest) =>
|
||||
useApiFetch<TokenResponse>('/api/v1/auth/otp/verify', { method: 'POST', body })
|
||||
|
||||
const startCieLogin = (frontendRedirectUri: string) =>
|
||||
useApiFetch<CieStartResponse>('/api/v1/auth/cie/start', {
|
||||
method: 'POST',
|
||||
body: { frontend_redirect_uri: frontendRedirectUri }
|
||||
})
|
||||
|
||||
const fetchCieSession = (id: string) =>
|
||||
useApiFetch<CieSessionResponse>(`/api/v1/auth/cie/session/${id}`, { method: 'GET' })
|
||||
|
||||
const updateProfile = (body: UpdateProfileRequest) =>
|
||||
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'PATCH', body })
|
||||
|
||||
@@ -110,6 +121,8 @@ export const useAuth = () => {
|
||||
register,
|
||||
requestOtp,
|
||||
verifyOtp,
|
||||
startCieLogin,
|
||||
fetchCieSession,
|
||||
updateProfile,
|
||||
fetchCurrentUser,
|
||||
fetchRewards,
|
||||
|
||||
Reference in New Issue
Block a user