Skip to content

Commit

Permalink
More Auth Headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mraysu committed Dec 9, 2024
1 parent 7b944e3 commit 4d071bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/components/ProgramForm/ProgramArchive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type archiveProps = {
isMobile?: boolean;
setPrograms: React.Dispatch<React.SetStateAction<ProgramMap>>;
setAlertState: React.Dispatch<React.SetStateAction<{ open: boolean; message: string }>>;
firebaseToken: string | undefined;
};

function ProgramArchiveHeader({ label }: props) {
Expand Down Expand Up @@ -50,13 +51,13 @@ function ProgramArchiveHeader({ label }: props) {
);
}

//Currently no functionality, just a button that closes the form
export default function ProgramArchive({
setOpenParent,
data,
isMobile = false,
setPrograms,
setAlertState,
firebaseToken,
}: archiveProps) {
const [openArchive, setOpenArchive] = useState(false);
const {
Expand All @@ -67,14 +68,16 @@ export default function ProgramArchive({
} = useForm<{ date: string }>();

const archive: MouseEventHandler = () => {
if (!firebaseToken) return;

const date = new Date(getArchiveValue("date"));
const today = new Date();
if (
date.getDate() === today.getDate() &&
date.getMonth() === today.getMonth() &&
date.getFullYear() === today.getFullYear()
) {
archiveProgram(data)
archiveProgram(data, firebaseToken)
.then((result) => {
if (result.success) {
console.log(result.data);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ProgramFormButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default function ProgramFormButton({
data={data}
setPrograms={setPrograms}
setAlertState={setAlertState}
firebaseToken={firebaseToken}
/>
)}

Expand Down

0 comments on commit 4d071bd

Please sign in to comment.