Commit 0e9a8ad1 authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: don't redirect to success screen when saved as draft

parent d2e86d44
Pipeline #181558 canceled with stage
in 8 minutes and 26 seconds
......@@ -54,7 +54,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: DatasetDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -73,6 +77,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -56,7 +56,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: DatasetDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -75,6 +79,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -54,7 +54,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: PublicationDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -73,6 +77,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -56,7 +56,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: PublicationDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -75,6 +79,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -52,7 +52,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: ToolDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -71,6 +75,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -54,7 +54,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: ToolDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -73,6 +77,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -52,7 +52,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: TrainingMaterialDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -71,6 +75,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -54,7 +54,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
onSuccess(data: TrainingMaterialDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -73,6 +77,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -98,7 +98,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
function onSuccess(data: WorkflowDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -117,6 +121,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
......@@ -112,7 +112,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
function onSuccess(data: WorkflowDto) {
toast.success(
`Successfully ${
isAllowedToPublish ? 'published' : 'submitted'
isAllowedToPublish
? 'published'
: data.status === 'draft'
? 'saved as draft'
: 'submitted'
} ${categoryLabel}.`,
)
......@@ -131,6 +135,8 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
*/
if (data.status === 'approved') {
router.push({ pathname: `/${data.category}/${data.persistentId}` })
} else if (data.status === 'draft') {
router.push({ pathname: '/' })
} else {
router.push({ pathname: '/success' })
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment