mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-13 02:37:57 +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
|
||||
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[]> {
|
||||
|
@ -97,7 +97,7 @@ const ActionChooser = (props: ActionProps): React.ReactElement => {
|
||||
<FormattedMessage id="action.print" defaultMessage="Print" />
|
||||
</MenuItem>
|
||||
|
||||
{role != 'viewer' &&
|
||||
{role == 'owner' &&
|
||||
<MenuItem onClick={handleOnClose('publish')}>
|
||||
<ListItemIcon>
|
||||
<PublicOutlinedIcon />
|
||||
@ -106,7 +106,7 @@ const ActionChooser = (props: ActionProps): React.ReactElement => {
|
||||
</MenuItem>
|
||||
}
|
||||
|
||||
{role != 'viewer' &&
|
||||
{role == 'owner' &&
|
||||
<MenuItem onClick={handleOnClose('share')}>
|
||||
<ListItemIcon>
|
||||
<ShareOutlinedIcon />
|
||||
|
Loading…
Reference in New Issue
Block a user