File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ import { ShelterCardComponent } from './shelters/shelter-card/shelter-card.compo
2121import { RequestShelterComponent } from './request-shelter/request-shelter.component' ;
2222import { 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 ,
Original file line number Diff line number Diff line change 11export 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} ;
Original file line number Diff line number Diff line change @@ -13,14 +13,16 @@ require('dotenv').config();
1313const SECRET = process . env . SECRET ;
1414const DB_HOST = process . env . DB_HOST ;
1515const DB_PORT = process . env . DB_PORT ;
16+ const DB_USER = process . env . DB_USER ;
17+ const DB_PASS = process . env . DB_PASS ;
1618const SERVER_PORT = process . env . SERVER_PORT || 3000
1719const SERVER_HOST = process . env . SERVER_HOST || 'localhost'
1820const SWAGGER_JSON_PATH = process . env . SWAGGER_JSON_PATH || '/swagger.json'
1921const SWAGGER_DOCUMENTATION_PATH = process . env . SWAGGER_DOCUMENTATION_PATH || '/documentation'
2022const SWAGGER_UI_PATH = process . env . SWAGGER_UI_PATH || '/swaggerui/'
2123const 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
2527const validate = async function ( decoded , request ) {
2628 const user = await User . findOne ( { _id : decoded . id } )
You can’t perform that action at this time.
0 commit comments