-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update gang admin form #1042
base: master
Are you sure you want to change the base?
update gang admin form #1042
Conversation
eff8517
to
337c657
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La inn noen kommentarer:)
defaultOption?: DropDownOption<unknown>; | ||
defaultOption?: unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hvorfor gjøres dette?
function handleOnSubmit(data: GangDto) { | ||
setExternalErrors({}); | ||
if (id) { | ||
// TODO patch | ||
// Update page. | ||
putGang(id, data) | ||
.then(() => { | ||
toast.success(t(KEY.common_update_successful)); | ||
}) | ||
.catch((error) => { | ||
toast.error(t(KEY.common_something_went_wrong)); | ||
setExternalErrors(error.response.data); | ||
}); | ||
navigate({ url: ROUTES.frontend.admin_gangs }); | ||
} else { | ||
// TODO post | ||
// Post new page. | ||
postGang(data) | ||
.then(() => { | ||
navigate({ url: ROUTES.frontend.admin_gangs }); | ||
toast.success(t(KEY.common_creation_successful)); | ||
}) | ||
.catch((error) => { | ||
toast.error(t(KEY.common_something_went_wrong)); | ||
setExternalErrors(error.response.data); | ||
}); | ||
} | ||
alert('TODO'); | ||
console.log(JSON.stringify(data)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admin form did not work
added post and put for gang
Also here is the fix for initial data for DropDown