Added end to end encryption

This commit is contained in:
Aslan 2026-01-13 17:33:23 -05:00
parent 9153ba841d
commit 575e9e2010
131 changed files with 2289 additions and 1670 deletions

View file

@ -4,18 +4,18 @@ import {
updateRoleApi,
removeRoleApi,
} from "../../api/role";
import { RoleActionTypes } from "../../store/role";
import { dispatch } from "../../store/state";
import { deleteRole, setRole } from "../../store/role";
const fetchRole = async (id: string) => {
const data = await fetchRoleApi({
id: id,
});
dispatch({
type: RoleActionTypes.FETCH_ROLE_FINISH,
payload: data,
});
if (typeof data.error === "string") {
return;
}
setRole(data);
};
const createRole = async (name: string, communityId: string) => {
@ -24,10 +24,11 @@ const createRole = async (name: string, communityId: string) => {
communityId: communityId,
});
dispatch({
type: RoleActionTypes.CREATE_ROLE_FINISH,
payload: data,
});
if (typeof data.error === "string") {
return;
}
setRole(data);
};
const updateRole = async (id: string, name?: string) => {
@ -36,10 +37,11 @@ const updateRole = async (id: string, name?: string) => {
name: name,
});
dispatch({
type: RoleActionTypes.UPDATE_ROLE_FINISH,
payload: data,
});
if (typeof data.error === "string") {
return;
}
setRole(data);
};
const removeRole = async (id: string) => {
@ -47,10 +49,11 @@ const removeRole = async (id: string) => {
id: id,
});
dispatch({
type: RoleActionTypes.REMOVE_ROLE_FINISH,
payload: data,
});
if (typeof data.error === "string") {
return;
}
deleteRole(data.id);
};
export { fetchRole, createRole, updateRole, removeRole };