mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 23:42:07 +01:00
refactor: simplify user update logic by removing unnecessary ui_settings handling
This commit is contained in:
@@ -3,7 +3,6 @@ import type { Emitter } from "mitt";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { inject, onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { UserSchema } from "@/__generated__";
|
||||
import CreateUserDialog from "@/components/Settings/Administration/Users/Dialog/CreateUser.vue";
|
||||
import DeleteUserDialog from "@/components/Settings/Administration/Users/Dialog/DeleteUser.vue";
|
||||
import InviteLinkDialog from "@/components/Settings/Administration/Users/Dialog/InviteLink.vue";
|
||||
@@ -62,14 +61,7 @@ const HEADERS = [
|
||||
] as const;
|
||||
|
||||
function disableUser(user: User) {
|
||||
const userUpdate = {
|
||||
...user,
|
||||
ui_settings: user.ui_settings
|
||||
? JSON.stringify(user.ui_settings)
|
||||
: undefined,
|
||||
} as Partial<UserSchema> & { ui_settings?: string };
|
||||
|
||||
userApi.updateUser(userUpdate).catch(({ response, message }) => {
|
||||
userApi.updateUser(user).catch(({ response, message }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `Unable to disable/enable user: ${
|
||||
response?.data?.detail || response?.statusText || message
|
||||
|
||||
@@ -54,7 +54,6 @@ async function updateUser({
|
||||
}: Partial<UserSchema> & {
|
||||
avatar?: File;
|
||||
password?: string;
|
||||
ui_settings?: string;
|
||||
}): Promise<{ data: UserSchema }> {
|
||||
return api.put(
|
||||
`/users/${id}`,
|
||||
|
||||
Reference in New Issue
Block a user