fix: keep unconfirmed candidates in rectification
This commit is contained in:
@@ -16,7 +16,6 @@ type DraftRevision = GuidedMutation & {
|
||||
};
|
||||
type CandidateSave = GuidedMutation & { readonly resultId: string };
|
||||
type CandidateConfirmation = CandidateSave & { readonly time: string };
|
||||
type CandidateCompletion = Pick<CandidateSave, "caseId" | "resultId"> & { readonly time: string };
|
||||
|
||||
const errorPayloadSchema = z.object({
|
||||
message: z.string().optional(),
|
||||
@@ -69,22 +68,3 @@ export function confirmGuidedBirthTimeCandidate(
|
||||
) {
|
||||
return send({ type: "confirm_guided_candidate", ...input });
|
||||
}
|
||||
|
||||
export async function completeGuidedBirthTimeCandidate(
|
||||
input: CandidateCompletion,
|
||||
) {
|
||||
const { response, payload } = await postJson({
|
||||
url: "/api/birth-time-candidate-completion",
|
||||
body: JSON.stringify(input),
|
||||
retryLostResponse: false,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const parsed = errorPayloadSchema.safeParse(payload);
|
||||
throw new GuidedBirthTimeRequestError(
|
||||
response.status,
|
||||
parsed.success
|
||||
? parsed.data.message ?? parsed.data.error ?? "候选时间暂时无法保存"
|
||||
: "候选时间暂时无法保存",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export function isBirthTimeDraftReady(draft: BirthTimeDraft) {
|
||||
|
||||
export function isBirthTimeReadyForConsultation(draft: BirthTimeDraft) {
|
||||
return Boolean(draft.time)
|
||||
&& (draft.birthTimeStatus === "candidate" || draft.birthTimeStatus === "confirmed");
|
||||
&& draft.birthTimeStatus === "confirmed";
|
||||
}
|
||||
|
||||
export function birthTimePersistenceValues(draft: BirthTimeDraft) {
|
||||
|
||||
Reference in New Issue
Block a user