Skip to content

Commit

Permalink
feat/invalidate after deleting & job alert layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamsheye committed Oct 23, 2024
1 parent 617e462 commit 9f46791
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/job-alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type IJobAlertProps = {

const JobAlert = ({ alert, onDelete }: IJobAlertProps) => {
return (
<div className="shrink basis-[calc(50%_-_4px)] rounded-[32px] bg-form p-6 md:rounded-[40px] md:p-8 lg:basis-[calc(33.33%_-_0.67rem)]">
<div className="flex w-[calc(50%_-_4px)] flex-col justify-between rounded-[32px] bg-form p-6 md:rounded-[40px] md:p-8 lg:w-[calc(33%_-_8px)]">
<Link
to="/jobs/$id"
params={{ id: alert.id }}
Expand Down
5 changes: 4 additions & 1 deletion src/routes/_auth_routes/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react";
import { createFileRoute, Link } from "@tanstack/react-router";
import { createFileRoute, Link, useRouter } from "@tanstack/react-router";
import toast from "react-hot-toast";
import JobAlert from "@/components/job-alert";
import DialogModal from "@/components/modal";
Expand All @@ -20,6 +20,8 @@ export const Route = createFileRoute("/_auth_routes/dashboard")({
});

function Dashboard() {
const router = useRouter();

const { jobAlerts } = Route.useLoaderData();
const [showDeleteModal, setShowDeleteModal] = useState<string | null>(null);

Expand All @@ -31,6 +33,7 @@ function Dashboard() {
toast.dismiss(toastId);
toast.success("deleted job alert");
setShowDeleteModal(null);
router.invalidate();
} catch (error) {
toast.dismiss(toastId);
toastError(error);
Expand Down

0 comments on commit 9f46791

Please sign in to comment.