mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: implement contributor editing for activities
This commit is contained in:
parent
95c3550c42
commit
b6059f8d5c
8 changed files with 164 additions and 82 deletions
|
|
@ -22,11 +22,22 @@ function EditorWrapper(props: EditorWrapperProps): JSX.Element {
|
|||
let activity = props.activity
|
||||
activity.content = content
|
||||
|
||||
toast.promise(updateActivity(activity, activity.activity_uuid, access_token), {
|
||||
loading: 'Saving...',
|
||||
success: <b>Activity saved!</b>,
|
||||
error: <b>Could not save.</b>,
|
||||
})
|
||||
toast.promise(
|
||||
updateActivity(activity, activity.activity_uuid, access_token).then(res => {
|
||||
if (!res.success) {
|
||||
throw res;
|
||||
}
|
||||
return res;
|
||||
}),
|
||||
{
|
||||
loading: 'Saving...',
|
||||
success: () => <b>Activity saved!</b>,
|
||||
error: (err) => {
|
||||
const errorMessage = err?.data?.detail || err?.data?.message || `Error ${err?.status}: Could not save`;
|
||||
return <b>{errorMessage}</b>;
|
||||
},
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue