mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-21 14:17:56 +01:00
WIP: share rest imlp
This commit is contained in:
parent
4908bcc993
commit
b7c5ff3940
@ -16,7 +16,24 @@ export default class RestClient implements Client {
|
|||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
addMapPermissions(id: number, message: string, permissions: Permission[]): Promise<void> {
|
addMapPermissions(id: number, message: string, permissions: Permission[]): Promise<void> {
|
||||||
throw new Error('Method not implemented.');
|
const handler = (success: () => void, reject: (error: ErrorInfo) => void) => {
|
||||||
|
axios.put(`${this.baseUrl}/c/restful/maps/${id}/collabs/`,
|
||||||
|
{
|
||||||
|
messasge: message,
|
||||||
|
collaborations: permissions
|
||||||
|
},
|
||||||
|
{ headers: { 'Content-Type': 'application/json' } }
|
||||||
|
).then(() => {
|
||||||
|
// All was ok, let's sent to success page ...;
|
||||||
|
success();
|
||||||
|
}).catch(error => {
|
||||||
|
const errorInfo = this.parseResponseOnError(error.response);
|
||||||
|
reject(errorInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return new Promise(handler);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchMapPermissions(id: number): Promise<Permission[]> {
|
fetchMapPermissions(id: number): Promise<Permission[]> {
|
||||||
|
@ -97,7 +97,7 @@ const ActionChooser = (props: ActionProps): React.ReactElement => {
|
|||||||
<FormattedMessage id="action.print" defaultMessage="Print" />
|
<FormattedMessage id="action.print" defaultMessage="Print" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
{role != 'viewer' &&
|
{role == 'owner' &&
|
||||||
<MenuItem onClick={handleOnClose('publish')}>
|
<MenuItem onClick={handleOnClose('publish')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<PublicOutlinedIcon />
|
<PublicOutlinedIcon />
|
||||||
@ -106,7 +106,7 @@ const ActionChooser = (props: ActionProps): React.ReactElement => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
}
|
}
|
||||||
|
|
||||||
{role != 'viewer' &&
|
{role == 'owner' &&
|
||||||
<MenuItem onClick={handleOnClose('share')}>
|
<MenuItem onClick={handleOnClose('share')}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<ShareOutlinedIcon />
|
<ShareOutlinedIcon />
|
||||||
|
Loading…
Reference in New Issue
Block a user