feat(users): add user type modification functionality
- Add modifyType API endpoint in userApi - Implement user type modification in Users.vue
This commit is contained in:
@@ -50,7 +50,10 @@ export const userApi = {
|
|||||||
api.post('/userMgr/create', { username, passwd, type }),
|
api.post('/userMgr/create', { username, passwd, type }),
|
||||||
removeUser: (targetUserID) =>
|
removeUser: (targetUserID) =>
|
||||||
api.post('/userMgr/remove', { targetUserID }),
|
api.post('/userMgr/remove', { targetUserID }),
|
||||||
listUsers: () => api.get('/userMgr/list')
|
listUsers: () =>
|
||||||
|
api.get('/userMgr/list'),
|
||||||
|
modifyType: (userID, newType) =>
|
||||||
|
api.post(`/userMgr/modifyType`, { userID, newType: newType.toLowerCase() || 'visitor' })
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sessionApi = {
|
export const sessionApi = {
|
||||||
|
|||||||
@@ -140,7 +140,14 @@ export default {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
} else if (showEditModal.value) {
|
} else if (showEditModal.value) {
|
||||||
showNotification('Edit user feature is not implemented yet', 'warning');
|
try {
|
||||||
|
await userApi.modifyType(editingUserId.value, formData.value.type);
|
||||||
|
showNotification('User type modified successfully', 'success');
|
||||||
|
closeModal();
|
||||||
|
await loadUsers();
|
||||||
|
} catch (error) {
|
||||||
|
showNotification(error.message || 'Failed to modify user type', 'error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
const APP_TARGET = '192.168.1.4:38080'
|
const APP_TARGET = 'localhost:8080'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
define: {
|
define: {
|
||||||
|
|||||||
Reference in New Issue
Block a user