[FE][Certs] Refresh register list on add
This commit is contained in:
parent
3734c49084
commit
b458eeedd2
@ -5,10 +5,13 @@ import { Register } from "../../types/Register";
|
|||||||
import { courseMap } from "../../utils/allCourses";
|
import { courseMap } from "../../utils/allCourses";
|
||||||
import { certGenerator } from "../../certGenerator";
|
import { certGenerator } from "../../certGenerator";
|
||||||
|
|
||||||
export function Registers(props: {person: Person | null}) {
|
export function Registers(props: {person: Person | null, count: number}) {
|
||||||
const [registers, setRegisters] = createSignal<Array<Register>>([]);
|
const [registers, setRegisters] = createSignal<Array<Register>>([]);
|
||||||
|
|
||||||
createEffect(async() => {
|
createEffect(async() => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const _count = props.count;
|
||||||
|
|
||||||
if (props.person === null) {
|
if (props.person === null) {
|
||||||
setRegisters([]);
|
setRegisters([]);
|
||||||
return;
|
return;
|
||||||
|
@ -6,12 +6,16 @@ import { Person } from "../types/Person";
|
|||||||
|
|
||||||
export function Certs() {
|
export function Certs() {
|
||||||
const [person, setPerson] = createSignal<Person | null>(null);
|
const [person, setPerson] = createSignal<Person | null>(null);
|
||||||
|
const [count, setCount] = createSignal(0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="grid grid-cols-[16rem_25rem_1fr]">
|
<div class="grid grid-cols-[16rem_25rem_1fr]">
|
||||||
<Search setPerson={setPerson} />
|
<Search setPerson={setPerson} />
|
||||||
<NewRegister personId={person()?.person_id ?? -1} onSuccess={() => {}} />
|
<NewRegister
|
||||||
<Registers person={person()} />
|
personId={person()?.person_id ?? -1}
|
||||||
|
onSuccess={() => setCount((x) => x + 1)}
|
||||||
|
/>
|
||||||
|
<Registers person={person()} count={count()} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user