feature/get-places-api #2
@ -1,4 +1,7 @@
|
||||
VITE_API_ORIGIN = http://176.53.196.42:6001/api/v1
|
||||
VITE_API_ORIGIN = https://admin.dev.dipal.ru/api/v1
|
||||
VITE_API_AUTH_ORIGIN = https://auth.dev.dipal.ru/api/v1/auth
|
||||
VITE_API_AUTH_PHONENUMBER = /start-challenge
|
||||
VITE_API_AUTH_LOGIN = /login
|
||||
VITE_API_PLACES = /place
|
||||
VITE_API_USERS = /profile
|
||||
VITE_API_USERS_ACCOUNT = /account
|
||||
|
@ -0,0 +1,31 @@
|
||||
import { staticMessages } from '~/driven/utils/constants/staticMessages';
|
||||
import { apiUrls } from '~/driven/utils/configs/appConfig';
|
||||
import { PhonenumberAuthDTOReturnType } from '~/business-logic/generic/admin-user/authentication/phonnumber-auth/data/dto/phonenumberDto';
|
||||
import { IPhonenumberAuthPort } from '~/business-logic/generic/admin-user/authentication/phonnumber-auth/port';
|
||||
import { HttpOptionsType } from '~/driven/boundaries/http-boundary/protocols';
|
||||
import { HTTPPovider } from '~/driven/boundaries/http-boundary/httpBoundary';
|
||||
|
||||
const authAdminPhoneNumberDriven = (): IPhonenumberAuthPort => {
|
||||
// make http handler ready for the phone number
|
||||
const wrongPhoneNumberMessage = staticMessages.global.errors.phonenumber;
|
||||
|
||||
const httpProvider = new HTTPPovider();
|
||||
const httpHandler = (data: PhonenumberAuthDTOReturnType) => {
|
||||
const url = apiUrls.generic.authPhonenumber;
|
||||
const options: HttpOptionsType = {
|
||||
url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data,
|
||||
};
|
||||
return httpProvider.request<string>(options);
|
||||
};
|
||||
|
||||
return {
|
||||
httpHandler,
|
||||
wrongPhoneNumberMessage,
|
||||
};
|
||||
};
|
||||
|
||||
export default authAdminPhoneNumberDriven;
|
@ -31,4 +31,8 @@ export const apiUrls = {
|
||||
createUserAccount: `${baseApiUrl}${ENVs.apiCreateUserAccount}`,
|
||||
createUserProfile: `${baseApiUrl}${ENVs.apiCreateUserProfile}`,
|
||||
},
|
||||
generic: {
|
||||
authPhonenumber: `${ENVs.apiAuthOrigin}${ENVs.apiAuthPhonenumber}`,
|
||||
authLogin: `${ENVs.apiAuthOrigin}${ENVs.apiAuthLogin}`,
|
||||
},
|
||||
};
|
||||
|
@ -1,5 +1,8 @@
|
||||
export const ENVs = {
|
||||
apiOrigin: process.env.VITE_API_ORIGIN,
|
||||
apiAuthOrigin: process.env.VITE_API_AUTH_ORIGIN,
|
||||
apiAuthPhonenumber: process.env.VITE_API_AUTH_PHONENUMBER,
|
||||
apiAuthLogin: process.env.VITE_API_AUTH_LOGIN,
|
||||
apiGetPlaces: process.env.VITE_API_PLACES,
|
||||
apiGetUsers: process.env.VITE_API_USERS,
|
||||
apiCreateUserAccount: process.env.VITE_API_USERS_ACCOUNT,
|
||||
|
@ -2,6 +2,7 @@ export const staticMessages = {
|
||||
global: {
|
||||
errors: {
|
||||
input: 'please fill all inputs correctly',
|
||||
phonenumber: 'please fill the valid number',
|
||||
},
|
||||
users: 'Users',
|
||||
submit: 'Submit',
|
||||
|
Loading…
x
Reference in New Issue
Block a user