Start adding stuff for user reminders

This commit is contained in:
jude 2024-03-03 21:58:48 +00:00
parent 329492b244
commit 85a114e55c
6 changed files with 25 additions and 4 deletions

View File

@ -175,3 +175,10 @@ export const deleteGuildTemplate = (guild: string) => ({
},
}),
});
export const fetchUserReminders = () => ({
queryKey: ["USER_REMINDERS"],
queryFn: () =>
axios.get(`/dashboard/api/user/reminders`).then((resp) => resp.data) as Promise<Reminder[]>,
staleTime: OTHER_STALE_TIME,
});

View File

@ -5,6 +5,7 @@ import { Welcome } from "../Welcome";
import { Guild } from "../Guild";
import { FlashProvider } from "./FlashProvider";
import { TimezoneProvider } from "./TimezoneProvider";
import { User } from "../User";
export function App() {
const queryClient = new QueryClient();
@ -18,6 +19,7 @@ export function App() {
<Sidebar />
<div class="column is-main-content">
<Switch>
<Route path={"/@me/reminders"} component={User}></Route>
<Route path={"/:guild/reminders"} component={Guild}></Route>
<Route>
<Welcome />

View File

@ -1,10 +1,10 @@
import { useParams } from "wouter";
import { useQuery } from "react-query";
import { fetchGuildChannels, fetchGuildReminders } from "../../api";
import { EditReminder } from "../Reminder/EditReminder";
import { CreateReminder } from "../Reminder/CreateReminder";
import { useState } from "preact/hooks";
import { Loader } from "../Loader";
import { useGuild } from "../App/useGuild";
enum Sort {
Time = "time",
@ -13,7 +13,7 @@ enum Sort {
}
export const GuildReminders = () => {
const { guild } = useParams();
const guild = useGuild();
const {
isSuccess,

View File

@ -1,13 +1,13 @@
import { useQuery } from "react-query";
import { fetchGuildInfo } from "../../api";
import { useParams } from "wouter";
import { GuildReminders } from "./GuildReminders";
import { GuildError } from "./GuildError";
import { createPortal } from "preact/compat";
import { Import } from "../Import";
import { useGuild } from "../App/useGuild";
export const Guild = () => {
const { guild } = useParams();
const guild = useGuild();
const { isSuccess, data: guildInfo } = useQuery(fetchGuildInfo(guild));
if (!isSuccess) {

View File

@ -0,0 +1,3 @@
export const UserReminders = () => {
return <></>;
};

View File

@ -0,0 +1,9 @@
import { UserReminders } from "./UserReminders";
export const User = () => {
return (
<>
<UserReminders />
</>
);
};