Create ExportBtn component + Change calendar adding url

This commit is contained in:
T'JAMPENS QUENTIN p2406187 committed 2026-03-16 15:34:48 +01:00
1 parent d6f69fa4a5
commit 76bf6384f5
3 files changed
+23 -12

No files matched your search

@@ -0,0 +1,20 @@
import Button from "../../../../components/ui/Button/Button";
import styles from "../../HomePage.module.css"
import { useContext } from "react";
import {AuthContext, AuthContextType} from "../../../../contexts/Auth/AuthContext";
export default function ExportBtn() {
const { user } = useContext(AuthContext) as AuthContextType;
const calendarUrl = `${import.meta.env.VITE_API_URL}/api/export/ics/${user?.id}`;
return <Button className={styles.exportbtn}
onClick={() => {
window.open(
`https://calendar.google.com/calendar/u/0/r/settings/addbyurl?cid=${calendarUrl}`
);
}}
>
Exporter
</Button>
}