Skip to content

Commit

Permalink
hotfix(create_campagin): users could now create campaign
Browse files Browse the repository at this point in the history
  • Loading branch information
m4ch374 committed Sep 26, 2023
1 parent adc3d58 commit 9c0153e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/pages/admin/AdminContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Button, ToggleButton, ToggleButtonGroup } from "@mui/material";
import { useContext, useEffect, useState } from "react";
import "twin.macro";

import { useNavigate } from "react-router-dom";

import { doDeleteOrg, putOrgLogo } from "api";
import { FetchError } from "api/api";
import { Modal } from "components";
Expand Down Expand Up @@ -54,6 +56,8 @@ const AdminContent = ({
orgName = "...";
}

const navigate = useNavigate();

const [windowSelected, setWindowSelected] = useState("campaigns");
const [showDeleteDialog, setShowDeleteDialog] = useState(false);
const [showEditDialog, setShowEditDialog] = useState(false);
Expand Down Expand Up @@ -188,7 +192,7 @@ const AdminContent = ({
<button
tw="text-gray-500 hover:text-gray-800 transition-colors"
type="button"
onClick={() => console.log("addition modal goes here")}
onClick={() => navigate(`/campaign/create/${id}`)}
>
<PlusIcon tw="w-12 h-12" />
</button>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/create_campaign/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ const CreateCampaign = () => {
questionsSend
);
await setCampaignCoverImage(campaignId, cover);
navigate("/admin");
} catch (err) {
if (err instanceof FetchError) {
try {
Expand Down

0 comments on commit 9c0153e

Please sign in to comment.