-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
94 lines (82 loc) · 2.74 KB
/
constants.ts
File metadata and controls
94 lines (82 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import {
ItemCategory,
ItemCondition,
ItemFilters,
ListingFiltersMap,
SubletFilters,
} from "@/lib/types";
export const BASE_URL =
process.env.NODE_ENV === "production" ? "REPLACE WITH PROD BASE URL" : "http://localhost:3000";
/**
* Server-side fetches (RSC, Route Handlers, middleware).
* - Local `pnpm dev`: default http://localhost:8000 (backend on host port).
* - Docker frontend service: set API_BASE_URL=http://backend:8000 in compose.
*/
export const API_BASE_URL =
process.env.NODE_ENV === "production"
? process.env.NEXT_PUBLIC_API_URL ?? "REPLACE WITH PROD API URL"
: (process.env.API_BASE_URL ?? "http://localhost:8000");
export const PLATFORM_URL = process.env.PLATFORM_URL;
export const CLIENT_ID = process.env.CLIENT_ID;
export const CLIENT_SECRET = process.env.CLIENT_SECRET;
export const OIDC_REDIRECT_URI = `${BASE_URL}/api/callback`;
export const OIDC_AUTHORIZATION_ENDPOINT = `${PLATFORM_URL}/accounts/authorize/`;
export const OIDC_TOKEN_ENDPOINT = `${API_BASE_URL}/accounts/token/`;
export const COOKIE_OPTIONS: {
httpOnly: boolean;
secure: boolean;
} = {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
};
export const ITEM_FILTER_KEYS: Array<keyof ItemFilters> = [
"category",
"condition",
"minPrice",
"maxPrice",
];
export const SUBLET_FILTER_KEYS: Array<keyof SubletFilters> = [
"numBeds",
"numBaths",
"startDate",
"endDate",
"minPrice",
"maxPrice",
];
export const CATEGORY_OPTIONS: Array<{ value: ItemCategory; label: string }> = [
{ value: "Art", label: "Art" },
{ value: "Books", label: "Books" },
{ value: "Clothing", label: "Clothing" },
{ value: "Electronics", label: "Electronics" },
{ value: "Furniture", label: "Furniture" },
{ value: "Home and Garden", label: "Home and Garden" },
{ value: "Music", label: "Music" },
{ value: "Other", label: "Other" },
{ value: "Tools", label: "Tools" },
{ value: "Vehicles", label: "Vehicles" },
];
export const CONDITION_OPTIONS: Array<{ value: ItemCondition; label: string }> = [
{ value: "NEW", label: "New" },
{ value: "LIKE_NEW", label: "Used - Like New" },
{ value: "GOOD", label: "Used - Good" },
{ value: "FAIR", label: "Used - Fair" },
];
export const BEDS_OPTIONS: Array<{ value: string; label: string }> = [
{ value: "1", label: "1 Bed" },
{ value: "2", label: "2 Beds" },
{ value: "3", label: "3 Beds" },
{ value: "4", label: "4 Beds" },
{ value: "5", label: "5+ Beds" },
];
export const BATHS_OPTIONS: Array<{ value: string; label: string }> = [
{ value: "1", label: "1 Bath" },
{ value: "2", label: "2 Baths" },
{ value: "3", label: "3 Baths" },
{ value: "4", label: "4+ Baths" },
];
export const DEFAULT_FILTERS: ListingFiltersMap = {
items: {
search: "",
},
sublets: {},
} as const;