course save fix

master
Tudor Stanciu 2020-05-03 03:24:26 +03:00
parent db3cf0db16
commit 3ba851ae41
1 changed files with 6 additions and 0 deletions

View File

@ -57,9 +57,15 @@ export function ManageCoursePage({
return Object.keys(errors).length === 0;
}
const checkSlug = () => {
if (course.slug) return;
course.slug = course.title.replace(/\s+/g, "-").toLowerCase();
};
function handleSave(event) {
event.preventDefault();
if (!formIsValid()) return;
checkSlug();
setSaving(true);
actions
.saveCourse(course)