mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
publish: update API actions for new arch
This commit is contained in:
parent
3e81faeac1
commit
c2f655878d
@ -74,6 +74,14 @@ export default class PublishApi extends BaseApi {
|
||||
});
|
||||
}
|
||||
|
||||
groupAction(act) {
|
||||
return this.action('group-store', 'group-action', act);
|
||||
}
|
||||
|
||||
inviteAction(act) {
|
||||
return this.action('invite-store', 'invite-action', act);
|
||||
}
|
||||
|
||||
publishAction(act) {
|
||||
return this.action('publish', 'publish-action', act);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export class Comments extends Component {
|
||||
|
||||
this.textArea.value = '';
|
||||
this.setState({ commentBody: '', awaiting: 'new' });
|
||||
const submit = this.props.api.action('publish', 'publish-action', comment);
|
||||
const submit = this.props.api.publishAction(comment);
|
||||
submit.then(() => {
|
||||
this.setState({ awaiting: null });
|
||||
});
|
||||
@ -88,7 +88,7 @@ export class Comments extends Component {
|
||||
this.setState({ awaiting: 'edit' });
|
||||
|
||||
window.api
|
||||
.action('publish', 'publish-action', comment)
|
||||
.publishAction(comment)
|
||||
.then(() => {
|
||||
this.setState({ awaiting: null, editing: null });
|
||||
});
|
||||
@ -107,7 +107,7 @@ export class Comments extends Component {
|
||||
|
||||
this.setState({ awaiting: { kind: 'del', what: idx } });
|
||||
window.api
|
||||
.action('publish', 'publish-action', comment)
|
||||
.publishAction(comment)
|
||||
.then(() => {
|
||||
this.setState({ awaiting: null });
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ export class JoinScreen extends Component {
|
||||
|
||||
// TODO: askHistory setting
|
||||
this.setState({ disable: true });
|
||||
this.props.api.action('publish','publish-action', actionData).catch((err) => {
|
||||
this.props.api.publishAction(actionData).catch((err) => {
|
||||
console.log(err);
|
||||
}).then(() => {
|
||||
this.setState({ awaiting: text });
|
||||
|
@ -93,7 +93,7 @@ export class NewScreen extends Component {
|
||||
}
|
||||
};
|
||||
this.setState({ awaiting: bookId, disabled: true }, () => {
|
||||
props.api.action('publish', 'publish-action', action).then(() => {
|
||||
props.api.publishAction(action).then(() => {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export class Notebook extends Component {
|
||||
book: this.props.book
|
||||
}
|
||||
};
|
||||
this.props.api.action('publish', 'publish-action', action);
|
||||
this.props.api.publishAction(action);
|
||||
this.props.history.push('/~publish');
|
||||
}
|
||||
|
||||
@ -112,6 +112,7 @@ export class Notebook extends Component {
|
||||
notebook={notebook}
|
||||
permissions={this.props.permissions}
|
||||
groups={this.props.groups}
|
||||
api={this.props.api}
|
||||
/>;
|
||||
break;
|
||||
case 'settings':
|
||||
@ -123,6 +124,7 @@ export class Notebook extends Component {
|
||||
contacts={this.props.contacts}
|
||||
associations={this.props.associations}
|
||||
history={this.props.history}
|
||||
api={this.props.api}
|
||||
/>;
|
||||
break;
|
||||
default:
|
||||
|
@ -63,7 +63,7 @@ export class Settings extends Component {
|
||||
|
||||
changeComments() {
|
||||
this.setState({ comments: !this.state.comments, disabled: true }, (() => {
|
||||
this.props.api.action('publish', 'publish-action', {
|
||||
this.props.api.publishAction({
|
||||
'edit-book': {
|
||||
book: this.props.book,
|
||||
title: this.props.notebook.title,
|
||||
@ -84,7 +84,7 @@ export class Settings extends Component {
|
||||
}
|
||||
};
|
||||
this.setState({ disabled: true, type: 'Deleting' });
|
||||
this.props.api.action('publish', 'publish-action', action).then(() => {
|
||||
this.props.api.publishAction(action).then(() => {
|
||||
this.props.history.push('/~publish');
|
||||
});
|
||||
}
|
||||
@ -108,7 +108,7 @@ export class Settings extends Component {
|
||||
disabled: true,
|
||||
type: 'Converting'
|
||||
}, (() => {
|
||||
this.props.api.action('publish', 'publish-action', {
|
||||
this.props.api.publishAction({
|
||||
groupify: {
|
||||
book: props.book,
|
||||
target: state.targetGroup,
|
||||
@ -125,7 +125,7 @@ export class Settings extends Component {
|
||||
|
||||
const ownedUnmanaged =
|
||||
owner &&
|
||||
props.notebook['writers-group-path'].slice(0, 3) === '/~/';
|
||||
props.notebook?.['writers-group-path'].slice(0, 3) === '/~/';
|
||||
|
||||
if (!ownedUnmanaged) {
|
||||
return null;
|
||||
@ -254,7 +254,7 @@ export class Settings extends Component {
|
||||
onBlur={() => {
|
||||
this.setState({ disabled: true });
|
||||
this.props.api
|
||||
.action('publish', 'publish-action', {
|
||||
.publishAction({
|
||||
'edit-book': {
|
||||
book: this.props.book,
|
||||
title: this.state.title,
|
||||
@ -281,7 +281,7 @@ export class Settings extends Component {
|
||||
onBlur={() => {
|
||||
this.setState({ disabled: true });
|
||||
this.props.api
|
||||
.action('publish', 'publish-action', {
|
||||
.publishAction({
|
||||
'edit-book': {
|
||||
book: this.props.book,
|
||||
title: this.props.notebook.title,
|
||||
|
@ -8,7 +8,7 @@ export class SidebarInvite extends Component {
|
||||
uid: this.props.uid
|
||||
}
|
||||
};
|
||||
window.api.action('invite-store', 'invite-action', action);
|
||||
this.props.api.inviteAction(action);
|
||||
}
|
||||
|
||||
onDecline() {
|
||||
@ -18,7 +18,7 @@ export class SidebarInvite extends Component {
|
||||
uid: this.props.uid
|
||||
}
|
||||
};
|
||||
this.props.api.action('invite-store', 'invite-action', action);
|
||||
this.props.api.inviteAction(action);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -17,7 +17,7 @@ export class Subscribers extends Component {
|
||||
path: path
|
||||
}
|
||||
};
|
||||
this.props.api.action('group-store', 'group-action', action);
|
||||
this.props.api.groupAction(action);
|
||||
}
|
||||
|
||||
removeUser(who, path) {
|
||||
@ -27,7 +27,7 @@ export class Subscribers extends Component {
|
||||
path: path
|
||||
}
|
||||
};
|
||||
this.props.api.action('group-store', 'group-action', action);
|
||||
this.props.api.groupAction(action);
|
||||
}
|
||||
|
||||
redirect(url) {
|
||||
|
Loading…
Reference in New Issue
Block a user