add: update user profile done
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user