basic file sharing

This commit is contained in:
2025-08-29 15:32:23 +02:00
parent c8b52a5b3b
commit 284d805590
84 changed files with 3969 additions and 375 deletions

View File

@@ -13,19 +13,37 @@ import type { UserWarren } from '~/shared/types/warrens';
const props = defineProps<{
userWarren: UserWarren;
}>();
let realUserWarrenState: UserWarren = JSON.parse(
JSON.stringify(props.userWarren)
);
const userWarren = props.userWarren;
const adminStore = useAdminStore();
const updatePermissionsDebounced = useDebounceFn(
async (userWarren: UserWarren) => {
const result = await editUserWarren(userWarren);
async (uw: UserWarren) => {
const result = await editUserWarren(uw);
if (result.success) {
for (const [key, value] of Object.entries(result.data)) {
if (key in userWarren) {
// @ts-expect-error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
userWarren[key] = value;
}
}
realUserWarrenState = JSON.parse(JSON.stringify(result.data));
toast.success('Permissions', {
description: `Successfully updated the user's permissions`,
});
} else {
for (const [key, value] of Object.entries(realUserWarrenState)) {
if (key in userWarren) {
// @ts-expect-error Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
userWarren[key] = value;
}
}
userWarren.canCreateShares = realUserWarrenState.canCreateShares;
toast.error('Permissions', {
description: `Failed to update the user's permissions`,
});