chore: removing unused const and imports

This commit is contained in:
مهرزاد قدرتی
2025-08-16 15:55:40 +03:30
parent 8a41aad9b9
commit 0cf3ae868f

View File

@@ -1,7 +1,6 @@
import apiClient from '@/lib/apiClient';
import axios from 'axios';
export interface GenerateToken {
export interface GenerateTokenWithPassword {
username: string;
password: string;
}
@@ -14,11 +13,9 @@ export interface GenerateTokenResponse {
scope: string;
}
const ACCESS_TOKEN_KEY: 'access_token' = 'access_token' as const;
const REFRESH_TOKEN_KEY: 'refresh_token' = 'refresh_token' as const;
const EXPIRES_IN_KEY: 'expires_in' = 'expires_in' as const;
export const generateTokenWithPassword = (request: GenerateToken) => {
export const generateTokenWithPassword = (
request: GenerateTokenWithPassword,
) => {
const body = new URLSearchParams();
body.set('grant_type', 'password');
body.set('client_id', import.meta.env.VITE_IDENTITY_CLIENT_ID);
@@ -36,3 +33,27 @@ export const generateTokenWithPassword = (request: GenerateToken) => {
},
);
};
export interface GenerateTokenWithOTP {
username: string;
otp: string;
}
export const generateTokenWithOtp = (request: GenerateTokenWithOTP) => {
const body = new URLSearchParams();
body.set('grant_type', 'otp');
body.set('client_id', import.meta.env.VITE_IDENTITY_CLIENT_ID);
body.set('scope', import.meta.env.VITE_IDENTITY_SCOPE);
body.set('username', request.username);
body.set('otp', request.otp);
return apiClient.post<GenerateTokenResponse>(
import.meta.env.VITE_IDENTITY_URL,
body.toString(),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
},
);
};