38 lines
1.6 KiB
TypeScript
38 lines
1.6 KiB
TypeScript
/*
|
|
* File: authAPI.ts
|
|
* Description: API service for authentication using apisauce
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|
|
|
|
import { create } from 'apisauce';
|
|
import { API_CONFIG } from '../../../shared/utils/constants';
|
|
import { buildHeaders } from '../../../shared/utils/api';
|
|
|
|
const api = create({
|
|
baseURL: API_CONFIG.BASE_URL, // TODO: Replace with actual endpoint
|
|
});
|
|
|
|
/**
|
|
* login - authenticates user with email and password
|
|
*/
|
|
export const authAPI = {
|
|
login: (email: string, password: string,platform:string) => api.post('/api/auth/auth/login', { email, password,platform },buildHeaders()),
|
|
//fetch hospital list
|
|
gethospitals: () => api.get('/api/hospitals/hospitals/app_user/hospitals', {},buildHeaders()),
|
|
//user signup
|
|
signup: (formData:any) => api.post('/api/auth/auth/admin/create-user-fromapp', formData,buildHeaders({ contentType: 'multipart/form-data' })),
|
|
//validate email
|
|
validatemail: (payload:{email:string}) => api.post('/api/auth/auth/check-email', payload,buildHeaders()),
|
|
//change password
|
|
changepassword: (payload:{password:string,token:string | undefined}) => api.post('/api/auth/onboarding/change-password', {password:payload.password},buildHeaders({token:payload.token})),
|
|
//validate username
|
|
validateusername: (username:string|undefined) => api.post('/api/auth/auth/check-username', {username},buildHeaders())
|
|
// Add more endpoints as needed
|
|
};
|
|
|
|
/*
|
|
* End of File: authAPI.ts
|
|
* Design & Developed by Tech4Biz Solutions
|
|
* Copyright (c) Spurrin Innovations. All rights reserved.
|
|
*/
|