Add OTP-first customer signup and product catalog PDF field.
Registration collects name and phone, verifies SMS, then asks for a password only for new Meshkee accounts. Product add/edit supports an optional catalog PDF. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
e2950fa20e
commit
6d85a217e1
@@ -7,6 +7,8 @@ import type {
|
||||
OtpSendResponse,
|
||||
OtpVerifyResponse,
|
||||
RegisterResponse,
|
||||
SignupStartResponse,
|
||||
SignupVerifyResponse,
|
||||
HandoffCreateResponse,
|
||||
UserProfile,
|
||||
} from '../types/auth'
|
||||
@@ -45,6 +47,40 @@ export async function register(input: {
|
||||
return data
|
||||
}
|
||||
|
||||
export async function startSignup(input: {
|
||||
cellNumber: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
domain: string
|
||||
}) {
|
||||
return apiRequest<SignupStartResponse>('/auth/signup/start', {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
})
|
||||
}
|
||||
|
||||
export async function verifySignupOtp(cellNumber: string, code: string) {
|
||||
return apiRequest<SignupVerifyResponse>('/auth/signup/verify-otp', {
|
||||
method: 'POST',
|
||||
body: { cellNumber, code },
|
||||
})
|
||||
}
|
||||
|
||||
export async function completeSignup(input: {
|
||||
registrationToken: string
|
||||
password?: string
|
||||
}) {
|
||||
const data = await apiRequest<RegisterResponse>('/auth/signup/complete', {
|
||||
method: 'POST',
|
||||
body: input,
|
||||
})
|
||||
|
||||
if (data.accessToken && data.refreshToken) {
|
||||
setTokens(data.accessToken, data.refreshToken)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
export async function fetchCurrentUser(signal?: AbortSignal) {
|
||||
return apiRequest<MeResponse>('/auth/me', { auth: true, signal })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user