Skip to content

Commit

Permalink
fix frontend build
Browse files Browse the repository at this point in the history
  • Loading branch information
gantoine committed May 14, 2024
1 parent 8b5f907 commit 62bfa69
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Dialog/User/DeleteUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const usersStore = storeUsers();
const emitter = inject<Emitter<Events>>("emitter");
emitter?.on("showDeleteUserDialog", (userToDelete) => {
user.value = userToDelete;
user.value = { password: "", ...userToDelete };
show.value = true;
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Dialog/User/EditUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const usersStore = storeUsers();
const imagePreviewUrl = ref<string | undefined>("");
const emitter = inject<Emitter<Events>>("emitter");
emitter?.on("showEditUserDialog", (userToEdit) => {
user.value = { ...userToEdit, avatar: undefined };
user.value = { ...userToEdit, password: "", avatar: undefined };
show.value = true;
});
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/services/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,10 @@ async function fetchCurrentUser(): Promise<{ data: UserSchema | null }> {

async function updateUser({
id,
username,
password,
role,
enabled,
avatar,
...attrs
}: {
id: number;
username: string;
password: string;
role: string;
enabled: boolean;
avatar?: File[];
}): Promise<{ data: UserSchema }> {
return api.put(
Expand All @@ -52,7 +45,7 @@ async function updateUser({
headers: {
"Content-Type": avatar ? "multipart/form-data" : "application/json",
},
params: { username, password, role, enabled },
params: attrs,
}
);
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/types/emitter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export type Events = {
};
showCreateExclusionDialog: { exclude: string };
showCreateUserDialog: null;
showEditUserDialog: UserItem;
showDeleteUserDialog: UserItem;
showEditUserDialog: User;
showDeleteUserDialog: User;
showDeleteSavesDialog: {
rom: Rom;
saves: SaveSchema[];
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/views/Settings/ControlPanel/Users/Base.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import userApi from "@/services/api/user";
import storeAuth from "@/stores/auth";
import storeUsers from "@/stores/users";
import type { Events, UserItem } from "@/types/emitter";
import storeUsers, { type User } from "@/stores/users";
import type { Events } from "@/types/emitter";
import { defaultAvatarPath, formatTimestamp } from "@/utils";
import type { Emitter } from "mitt";
import { inject, onMounted, ref } from "vue";
Expand Down Expand Up @@ -56,7 +56,7 @@ const usersStore = storeUsers();
const usersPerPage = ref(5);
const userSearch = ref("");
function disableUser(user: UserItem) {
function disableUser(user: User) {
userApi.updateUser(user).catch(({ response, message }) => {
emitter?.emit("snackbarShow", {
msg: `Unable to disable/enable user: ${
Expand Down

0 comments on commit 62bfa69

Please sign in to comment.