Skip to content

Commit

Permalink
fix: fixed access control
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMikhaelson committed Aug 23, 2023
2 parents 87ed961 + 375ebe7 commit a349ae4
Show file tree
Hide file tree
Showing 31 changed files with 697 additions and 351 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ const CreateGroupTest = () => {
{
'all': [
{
'type': 'PUSH',
'category': 'owner',
'type': PushAPI.ConditionType.PUSH,
'category': 'ERC20',
'subcategory': 'holder',
'data': {
'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ChatViewComponentTest = () => {
{/* <Loader show={isLoading} /> */}
<ChatViewComponentCard>

<ChatViewComponent onClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='196f58cbe07c7eb5716d939e0a3be1f15b22b2334d5179c601566600016860ac' limit={10}/>
<ChatViewComponent onClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='c4828a375fd261577927a9d73fe3fa30204c6667a3adbc345e010eccf5ec740e' limit={10}/>
</ChatViewComponentCard>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const CreateSpaceTest = () => {
numberOfERC20 != null ? Number(numberOfERC20) : undefined,
signer: librarySigner,
env,
meta: meta,
// meta: meta,
scheduleAt: new Date(scheduleAt),
scheduleEnd: scheduleEnd ? new Date(scheduleEnd) : null,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { useState, useContext } from 'react';
import {
Section,
SectionItem,
CodeFormatter,
SectionButton,
} from '../components/StyledComponents';
import Loader from '../components/Loader';
import { EnvContext } from '../context';
import * as PushAPI from '@pushprotocol/restapi';

const GetSpaceAccessTest = () => {
const { env } = useContext<any>(EnvContext);
const [isLoading, setLoading] = useState(false);
const [spaceId, setSpaceId] = useState<string>('');
const [did, setDid] = useState<string>('');
const [sendResponse, setSendResponse] = useState<any>('');

const updateSpaceId = (e: React.SyntheticEvent<HTMLElement>) => {
setSpaceId((e.target as HTMLInputElement).value);
};

const updateDid = (e: React.SyntheticEvent<HTMLElement>) => {
setDid((e.target as HTMLInputElement).value);
};

const testGetSpaceAccess = async () => {
try {
setLoading(true);

const response = await PushAPI.space.getAccess({
spaceId: spaceId,
did: did,
env,
});
setSendResponse(response);
} catch (e) {
console.error(e);
} finally {
setLoading(false);
}
};

return (
<div>
<h2>Get Space Access Test Page</h2>

<Loader show={isLoading} />

<Section>
<SectionItem>
<SectionButton onClick={testGetSpaceAccess}>get space access</SectionButton>
</SectionItem>
<SectionItem>
<label>spaceId</label>
<input
type="text"
onChange={updateSpaceId}
value={spaceId}
style={{ width: 400, height: 30 }}
/>
</SectionItem>
<SectionItem>
<label>did</label>
<input
type="text"
onChange={updateDid}
value={did}
style={{ width: 400, height: 30 }}
/>
</SectionItem>
<SectionItem>
<div>
{sendResponse ? (
<CodeFormatter>
{JSON.stringify(sendResponse, null, 4)}
</CodeFormatter>
) : null}
</div>
</SectionItem>
</Section>
</div>
);
};

export default GetSpaceAccessTest;
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const SpaceTest = () => {
<Link to="/getSpacesTrending" className="nav-button">
SPACE.GETSPACESTRENDING
</Link>
<Link to="/getSpaceAccess" className="nav-button">
SPACE.GETSPACEACCESS
</Link>
</NavMenu>
</Section>
</div>
Expand Down
7 changes: 6 additions & 1 deletion packages/examples/sdk-frontend-react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import RemoveSpeakersFromSpaceTest from './SpaceTest/RemoveSpeakersFromSpaceTest
import GetSpacesTest from './SpaceTest/GetSpacesTest';
import GetSpacesRequestsTest from './SpaceTest/GetSpacesRequestsTest';
import GetSpacesTrendingTest from './SpaceTest/GetSpacesTrendingTest';
import GetSpaceAccessTest from './SpaceTest/GetSpaceAccessTest';

import SpaceUITest from './SpaceUITest/SpaceUITest';
import {
SpaceWidget,
Expand Down Expand Up @@ -507,7 +509,10 @@ export function App() {
path="/getSpacesTrending"
element={<GetSpacesTrendingTest />}
/>

<Route
path="/getSpaceAccess"
element={<GetSpaceAccessTest />}
/>

{/* spaces ui components routes */}
<Route path="spaceWidget" element={<SpaceWidget />} />
Expand Down
Loading

0 comments on commit a349ae4

Please sign in to comment.