feat: client testing api , add ouath2

This commit is contained in:
Abdalhamid Alhamad
2025-01-16 13:35:22 +03:00
parent 87bb1a2709
commit ebd4b293e9
11 changed files with 160 additions and 52 deletions

View File

@ -1,8 +1,10 @@
import axios from 'axios';
import { LoginRequest } from '../types/auth';
import { CreateJuniorRequest, JuniorTheme } from '../types/junior';
import { CreateTaskRequest, TaskStatus, TaskSubmission } from '../types/task';
const API_BASE_URL = 'http://79.72.0.143';
// const API_BASE_URL = 'http://79.72.0.143';
const API_BASE_URL = 'http://localhost:5001';
const AUTH_TOKEN = btoa('zod-digital:Zod2025'); // Base64 encode credentials
// Helper function to get auth header
@ -75,11 +77,13 @@ export const authApi = {
return apiClient.post('/api/auth/register/set-passcode', { passcode });
},
login: (email: string, password: string) =>
login: ({ grantType, email, password, appleToken, googleToken }: LoginRequest) =>
apiClient.post('/api/auth/login', {
grantType: 'PASSWORD',
grantType,
email,
password,
appleToken,
googleToken,
fcmToken: 'web-client-token', // Required by API
signature: 'web-login', // Required by API
}),