forgot password in login page and account info implemented, sms.ir service works fine with sandbox key.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// src/lib/api/auth.ts
|
||||
import { apiClient } from './client';
|
||||
import type { AuthResponse, TrialRegistrationData, LoginData } from '@/types/auth';
|
||||
import type { AuthResponse, TrialRegistrationData, LoginData, ForgotPasswordVerifyResponse } from '@/types/auth';
|
||||
import type { SubscriptionAlertData } from '@/types/subscription';
|
||||
|
||||
export const authApi = {
|
||||
@@ -65,4 +65,25 @@ export const authApi = {
|
||||
const response = await apiClient.post('/auth/refresh', { refreshToken });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
sendForgotPasswordCode: async (mobile: string): Promise<{ success: boolean; message: string }> => {
|
||||
const response = await apiClient.post('/auth/forgot-password/send-code', { mobile });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
verifyForgotPasswordCode: async (
|
||||
mobile: string,
|
||||
code: string,
|
||||
): Promise<ForgotPasswordVerifyResponse> => {
|
||||
const response = await apiClient.post('/auth/forgot-password/verify', { mobile, code });
|
||||
return response.data;
|
||||
},
|
||||
|
||||
changePassword: async (data: {
|
||||
currentPassword?: string;
|
||||
newPassword: string;
|
||||
}): Promise<{ success: boolean; message: string }> => {
|
||||
const response = await apiClient.patch('/auth/profile/password', data);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
@@ -34,7 +34,9 @@ function shouldSkipRefreshRetry(url: string | undefined): boolean {
|
||||
url.includes('/auth/refresh') ||
|
||||
url.includes('/auth/login') ||
|
||||
url.includes('/auth/register') ||
|
||||
url.includes('/auth/logout')
|
||||
url.includes('/auth/logout') ||
|
||||
url.includes('/auth/forgot-password') ||
|
||||
url.includes('/auth/profile/password')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user