forgot password in login page and account info implemented, sms.ir service works fine with sandbox key.

This commit is contained in:
2026-07-04 00:01:58 +03:30
parent 2f95559087
commit 3f7364dbf0
26 changed files with 1000 additions and 38 deletions

View File

@@ -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;
},
};

View File

@@ -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')
);
}