mirror of
https://github.com/kevin-DL/full-stack-fastapi-postgresql.git
synced 2026-01-13 02:25:26 +00:00
✨ Update all for Postgres and new techniques
This commit is contained in:
@@ -3,7 +3,6 @@ import { ActionContext } from 'vuex';
|
||||
import {
|
||||
commitSetUsers,
|
||||
commitSetUser,
|
||||
commitSetRoles,
|
||||
} from './accessors/commit';
|
||||
import { IUserProfileCreate, IUserProfileUpdate } from '@/interfaces';
|
||||
import { State } from '../state';
|
||||
@@ -23,12 +22,12 @@ export const actions = {
|
||||
await dispatchCheckApiError(context, error);
|
||||
}
|
||||
},
|
||||
async actionUpdateUser(context: MainContext, payload: { name: string, user: IUserProfileUpdate }) {
|
||||
async actionUpdateUser(context: MainContext, payload: { id: number, user: IUserProfileUpdate }) {
|
||||
try {
|
||||
const loadingNotification = { content: 'saving', showProgress: true };
|
||||
commitAddNotification(context, loadingNotification);
|
||||
const response = (await Promise.all([
|
||||
api.updateUser(context.rootState.main.token, payload.name, payload.user),
|
||||
api.updateUser(context.rootState.main.token, payload.id, payload.user),
|
||||
await new Promise((resolve, reject) => setTimeout(() => resolve(), 500)),
|
||||
]))[0];
|
||||
commitSetUser(context, response.data);
|
||||
@@ -53,12 +52,4 @@ export const actions = {
|
||||
await dispatchCheckApiError(context, error);
|
||||
}
|
||||
},
|
||||
async actionGetRoles(context: MainContext) {
|
||||
try {
|
||||
const response = await api.getRoles(context.rootState.main.token);
|
||||
commitSetRoles(context, response.data.roles);
|
||||
} catch (error) {
|
||||
await dispatchCheckApiError(context, error);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user