Skip to content

Commit

Permalink
Purge hardcoded orgId
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg committed Jan 13, 2025
1 parent dcd59bd commit a60997c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/components/Questionnaire/QuestionnaireEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
import {
QuestionStatus,
QuestionnaireDetail,
QuestionnaireUpdate,
SubjectType,
} from "@/types/questionnaire/questionnaire";
import questionnaireApi from "@/types/questionnaire/questionnaireApi";
Expand Down Expand Up @@ -80,14 +79,11 @@ export default function QuestionnaireEditor({ id }: QuestionnaireEditorProps) {
});

const [questionnaire, setQuestionnaire] =
useState<QuestionnaireUpdate | null>(null);
useState<QuestionnaireDetail | null>(null);

useEffect(() => {
if (initialQuestionnaire) {
setQuestionnaire({
...initialQuestionnaire,
organizations: ["628b44da-3da0-4321-a75d-e53697b281bb"],
});
setQuestionnaire(initialQuestionnaire);
}
}, [initialQuestionnaire]);

Expand Down
4 changes: 1 addition & 3 deletions src/types/questionnaire/questionnaire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ export interface QuestionnaireDetail {
subject_type: SubjectType;
}

export interface QuestionnaireUpdate extends QuestionnaireDetail {
export interface QuestionnaireCreate extends Omit<QuestionnaireDetail, "id"> {
organizations: string[];
}

export type QuestionnaireCreate = Omit<QuestionnaireUpdate, "id">;

export interface QuestionnaireForms {
count: number;
results: QuestionnaireDetail[];
Expand Down
8 changes: 2 additions & 6 deletions src/types/questionnaire/questionnaireApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { HttpMethod, Type } from "@/Utils/request/api";
import { PaginatedResponse } from "@/Utils/request/types";

import { Organization } from "../organization/organization";
import {
QuestionnaireCreate,
QuestionnaireDetail,
QuestionnaireUpdate,
} from "./questionnaire";
import { QuestionnaireCreate, QuestionnaireDetail } from "./questionnaire";
import { QuestionnaireTag } from "./tags";

export default {
Expand All @@ -32,7 +28,7 @@ export default {
update: {
path: "/api/v1/questionnaire/{id}/",
method: HttpMethod.PUT,
TRes: Type<QuestionnaireUpdate>(),
TRes: Type<QuestionnaireDetail>(),
TBody: Type<QuestionnaireDetail>(),
},

Expand Down

0 comments on commit a60997c

Please sign in to comment.