Skip to content

Commit 530fcd1

Browse files
committed
Fix bugs
1 parent 39fbedf commit 530fcd1

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

client/src/app/app.module.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ import { ShelterCardComponent } from './shelters/shelter-card/shelter-card.compo
2121
import { RequestShelterComponent } from './request-shelter/request-shelter.component';
2222
import { ShelterInfoComponent } from './shelters/shelter-info/shelter-info.component';
2323

24+
export function tokenGetter() {
25+
const user = JSON.parse(localStorage.getItem('user'));
26+
if (!user) return '';
27+
return user.token;
28+
}
29+
2430
@NgModule({
2531
declarations: [
2632
AppComponent,
@@ -39,13 +45,9 @@ import { ShelterInfoComponent } from './shelters/shelter-info/shelter-info.compo
3945
HttpClientModule,
4046
JwtModule.forRoot({
4147
config: {
42-
tokenGetter: () => {
43-
const user = JSON.parse(localStorage.getItem('user'));
44-
if (!user) return '';
45-
return user.token;
46-
},
47-
whitelistedDomains: ['localhost:3000'],
48-
blacklistedRoutes: ['localhost:3000/api/users/']
48+
tokenGetter: tokenGetter,
49+
whitelistedDomains: ['localhost:3000', 'gymkhana.iitb.ac.in'],
50+
blacklistedRoutes: ['localhost:3000/api/users/', 'gymkhana.iitb.ac.in/codefundo/api/users/']
4951
}
5052
}),
5153
AppRoutingModule,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const environment = {
22
production: true,
3-
apiBaseUrl: 'http://localhost:3000/api',
3+
apiBaseUrl: 'https://gymkhana.iitb.ac.in/codefundo/api',
44
mapboxAccessToken: 'pk.eyJ1Ijoicm9oaXRycCIsImEiOiJjam5vejdtYmYyMG1tM3FzNXA1YnVib3JiIn0.5x5lvYoSAxmmc3EQAg19og',
55
googleMapsAPIKey: 'AIzaSyDoaA5lB4-JbSXElDWllnNU3QcArgxdreM'
66
};

server/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ require('dotenv').config();
1313
const SECRET = process.env.SECRET;
1414
const DB_HOST = process.env.DB_HOST;
1515
const DB_PORT = process.env.DB_PORT;
16+
const DB_USER = process.env.DB_USER;
17+
const DB_PASS = process.env.DB_PASS;
1618
const SERVER_PORT = process.env.SERVER_PORT || 3000
1719
const SERVER_HOST = process.env.SERVER_HOST || 'localhost'
1820
const SWAGGER_JSON_PATH = process.env.SWAGGER_JSON_PATH || '/swagger.json'
1921
const SWAGGER_DOCUMENTATION_PATH = process.env.SWAGGER_DOCUMENTATION_PATH || '/documentation'
2022
const SWAGGER_UI_PATH = process.env.SWAGGER_UI_PATH || '/swaggerui/'
2123
const BASE_PATH = process.env.BASE_PATH || ''
2224

23-
const dbUrl = `mongodb://${DB_HOST}:${DB_PORT}/reliefshelter`;
25+
const dbUrl = `mongodb://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/reliefshelter`;
2426

2527
const validate = async function (decoded, request) {
2628
const user = await User.findOne({_id: decoded.id})

0 commit comments

Comments
 (0)