add: update user profile done

This commit is contained in:
Alexandro Uc Santos
2024-04-06 14:48:13 -06:00
parent 84f71b98d1
commit e0a4cf4abb
10 changed files with 120 additions and 64 deletions

View File

@@ -6,6 +6,7 @@ import {useNotificationsStore} from './notifications';
import {useCompanyStore} from './company';
import { useLoadsStore } from "./loads";
import { useVehiclesStore } from "./vehicles";
import { updateMyUserProfile } from "../services/company";
export const useAuthStore = defineStore('auth', () => {
@@ -56,6 +57,17 @@ export const useAuthStore = defineStore('auth', () => {
});
});
const updateProfile = async(data) => {
const response = await updateMyUserProfile(data);
console.log(response);
if( response !== null) {
user.value = response;
return response;
} else {
return null;
}
}
const logout = () => {
localStorage.removeItem('access');
localStorage.removeItem('id');
@@ -82,6 +94,7 @@ export const useAuthStore = defineStore('auth', () => {
checking,
authStatus,
checkSession,
authenticationPromise
authenticationPromise,
updateProfile
}
});

View File

@@ -67,8 +67,9 @@ export const useLoadsStore = defineStore('load', () => {
const getProposalsOfLoads = async(filterQuery) => {
try {
const endpoint = `/v1/proposals/find?load=${filterQuery}`;
console.log(endpoint)
const {data} = await api.get(endpoint);
// console.log(data);
console.log(data);
proposalsOfLoads.value = data.data;
} catch (error) {
proposalsOfLoads.value = [];