Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/app/controllers/registrations_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export default class RegistrationsController {
const departmentId = params.department_id as unknown;

if (typeof departmentId === "string") {
const tmpDepId = decodeURIComponent(departmentId);
return Registration.query()
.where("departmentId", departmentId)
.where("departmentId", tmpDepId)
.andWhere("isActive", true)
.orWhereNull("isActive");
}
Expand Down
4 changes: 1 addition & 3 deletions backend/config/cors.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { defineConfig } from "@adonisjs/cors";

import env from "#start/env";

/**
* Configuration options to tweak the CORS policy. The following
* options are documented on the official documentation website.
Expand All @@ -10,7 +8,7 @@ import env from "#start/env";
*/
const corsConfig = defineConfig({
enabled: true,
origin: env.get("CORS_ORIGIN", "planer.solvro.pl").split(","), // ["http://localhost:3000", "http://localhost:8080"]
origin: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

czy ty wiesz co ty zrobiłeś??? @qamarq

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tak

methods: ["GET", "HEAD", "POST", "PUT", "DELETE"],
headers: true,
exposeHeaders: [],
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/plans/edit/[id]/page.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ export function CreateNewPlanPage({
const plan = usePlan({ planId });

const registrations = useQuery({
enabled: faculty !== null,
enabled: faculty !== null && faculty !== "",
queryKey: ["registrations", faculty],
queryFn: async () => {
const response = await fetch(
`${env.NEXT_PUBLIC_API_URL}/departments/${faculty ?? ""}/registrations`,
`${env.NEXT_PUBLIC_API_URL}/departments/${encodeURIComponent(faculty ?? "")}/registrations`,
);

if (!response.ok) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export function CreateNewPlanPage({
mutationKey: ["courses"],
mutationFn: async (registrationId: string) => {
const response = await fetch(
`${env.NEXT_PUBLIC_API_URL}/departments/${faculty?.toString() ?? ""}/registrations/${encodeURIComponent(registrationId)}/courses`,
`${env.NEXT_PUBLIC_API_URL}/departments/${encodeURIComponent(faculty ?? "")}/registrations/${encodeURIComponent(registrationId)}/courses`,
);

if (!response.ok) {
Expand Down