Skip to content

Commit

Permalink
fix(in-app): type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sdjdd committed Dec 12, 2023
1 parent a5826d2 commit b0534db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions in-app/v1/src/App/Tickets/Ticket/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { produce } from 'immer';
import { Helmet } from 'react-helmet-async';

import { auth, db, http } from '@/leancloud';
import { Reply, Ticket } from '@/types';
import { Evaluation, Reply, Ticket } from '@/types';
import { PageContent, PageHeader } from '@/components/Page';
import { QueryWrapper } from '@/components/QueryWrapper';
import styles from './index.module.css';
Expand Down Expand Up @@ -214,7 +214,7 @@ function useWatchStatus(ticketId: string, callback: (status: number) => void) {
}, [ticketId]);
}

async function commitEvaluation(ticketId: string, data: Ticket['evaluation']) {
async function commitEvaluation(ticketId: string, data: Evaluation) {
await http.patch(`/api/2/tickets/${ticketId}`, { evaluation: data });
}

Expand Down Expand Up @@ -289,7 +289,7 @@ export default function TicketDetail() {
const [editEval, setEditEval] = useState(false);

const { mutate: evaluate, isLoading: isEvaluating } = useMutation({
mutationFn: (data: Ticket['evaluation']) => commitEvaluation(id, data),
mutationFn: (data: Evaluation) => commitEvaluation(id, data),
onSuccess: (_, evaluation) => {
setEditEval(false);
queryClient.setQueryData<Ticket | undefined>(['ticket', id], (data) => {
Expand Down
5 changes: 3 additions & 2 deletions in-app/v1/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export interface File {

export interface Evaluation {
star: 0 | 1;
content: string;
content?: string;
selections?: string[];
}

export interface EvaluationTag {
Expand All @@ -37,7 +38,7 @@ export interface TicketListItem {
title: string;
status: number;
files?: File[];
evaluation: Evaluation | null;
evaluation?: Evaluation;
unreadCount: number;
createdAt: string;
updatedAt: string;
Expand Down

0 comments on commit b0534db

Please sign in to comment.