Added end to end encryption
This commit is contained in:
parent
9153ba841d
commit
575e9e2010
131 changed files with 2289 additions and 1670 deletions
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue