mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-28 12:43:12 +08:00
[resumes][fix] invalidate fetch query on submit
This commit is contained in:
@ -80,6 +80,7 @@ export default function SubmitResumeForm({
|
|||||||
|
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const trpcContext = trpc.useContext();
|
||||||
const resumeUpsertMutation = trpc.useMutation('resumes.resume.user.upsert');
|
const resumeUpsertMutation = trpc.useMutation('resumes.resume.user.upsert');
|
||||||
const isNewForm = initFormDetails == null;
|
const isNewForm = initFormDetails == null;
|
||||||
|
|
||||||
@ -170,6 +171,7 @@ export default function SubmitResumeForm({
|
|||||||
},
|
},
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
if (isNewForm) {
|
if (isNewForm) {
|
||||||
|
trpcContext.invalidateQueries('resumes.resume.findAll');
|
||||||
router.push('/resumes/browse');
|
router.push('/resumes/browse');
|
||||||
} else {
|
} else {
|
||||||
onClose();
|
onClose();
|
||||||
@ -228,7 +230,7 @@ export default function SubmitResumeForm({
|
|||||||
<Head>
|
<Head>
|
||||||
<title>Upload a Resume</title>
|
<title>Upload a Resume</title>
|
||||||
</Head>
|
</Head>
|
||||||
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-scroll">
|
<main className="h-[calc(100vh-4rem)] flex-1 overflow-y-auto">
|
||||||
<section
|
<section
|
||||||
aria-labelledby="primary-heading"
|
aria-labelledby="primary-heading"
|
||||||
className="flex h-full min-w-0 flex-1 flex-col lg:order-last">
|
className="flex h-full min-w-0 flex-1 flex-col lg:order-last">
|
||||||
|
Reference in New Issue
Block a user