EN-94: fix: Migrate to api v1

This commit is contained in:
Josepablo Cruz Baas
2024-03-12 03:25:39 +00:00
parent 5e6de53098
commit 33e5c8caa4
11 changed files with 90 additions and 31 deletions

View File

@@ -11,6 +11,8 @@
import { useRouter } from 'vue-router';
import { useNotificationsStore } from '../stores/notifications';
import { useAuthStore } from '../stores/auth';
import { complete_registry } from "../services/auth";
import { updateMyUserProfile } from "../services/company"
const notifications = useNotificationsStore();
const auth = useAuthStore();
@@ -63,14 +65,36 @@
console.log(company);
}
const handleSendRegister = () => {
const handleSendRegister = async () => {
const error = validatiosUser();
if(error != '') {
msgError.value = error;
clearMessages();
return;
}
console.log(user);
const companyData = {
company_name : company.name,
rfc : company.rfc,
categories: company.segments.map((e) => e._id ),
company_city: company.cities.map((e) => e.city_name),
company_state: company.states.map((e) => e.state_name),
truck_type: company.truckTypes.map((e) => e.meta_value),
company_description : company.description,
company_type : typeCompany.typeCompany,
};
const result = await complete_registry( companyData );
console.log(result);
if(result.msg === 'success' && result.data !== null){
localStorage.setItem('id', result.data._id);
}
const userData = {
"first_name" : user.name,
"last_name" : user.lastName,
"phone" : user.phone1,
"phone2" : user.phone2,
};
await updateMyUserProfile( userData );
/////// Datos debug ///////
notifications.show = true;
notifications.text = 'Los datos se llenaron correctamente';