basic file sharing
This commit is contained in:
@@ -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`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user