Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

update gang admin form #1042

wants to merge 1 commit into from

Conversation

magsyg
Copy link
Contributor

@magsyg magsyg commented Mar 25, 2024

Admin form did not work

added post and put for gang

Also here is the fix for initial data for DropDown

@magsyg magsyg requested a review from Snorre98 as a code owner March 25, 2024 18:12
@magsyg magsyg self-assigned this Mar 27, 2024
Copy link
Contributor

@amaliejvik amaliejvik left a 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hvorfor gjøres dette?

Comment on lines 81 to 106
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));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tror et eller annet ikke fungerer med post/put (?)
Får opp dette i konsollen når jeg prøver å opprette en gjeng.

Skjermbilde 2024-04-11 kl  20 41 58

@robines robines added the stale Inactive issue or pull request label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Inactive issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants