Changeset 79a0317 for imaps-frontend/src/scripts/net
- Timestamp:
- 01/21/25 03:08:24 (2 weeks ago)
- Branches:
- main
- Parents:
- 0c6b92a
- Location:
- imaps-frontend/src/scripts/net
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/src/scripts/net/HttpService.js
r0c6b92a r79a0317 5 5 constructor(auth = false) { 6 6 this.auth = auth; 7 this.responseType = 'json'; 7 8 } 8 9 … … 10 11 this.auth = true; 11 12 } 13 setResponseType(type){ 14 if(type === 'text'){ 15 this.responseType = 'text'; 16 } else if (type === 'json'){ 17 this.responseType = 'json' 18 } else { 19 console.error('unsupported response type in http service') 20 } 21 } 22 12 23 13 24 async request(method, endpoint, data = null) { … … 53 64 54 65 console.log("HTTPSERVICE: RESPONSE:",response); 55 56 return response.json(); 66 67 if(this.responseType === 'json'){ 68 return response.json(); 69 } else if (this.responseType === 'text'){ 70 return response.text() 71 } else{ 72 console.error('bad resp type') 73 } 57 74 } 58 75 -
imaps-frontend/src/scripts/net/netconfig.js
r0c6b92a r79a0317 14 14 publish: `${API_PROTECTED}/publish/add`, 15 15 publish_get: `${API_PROTECTED}/publish/get`, 16 edit_map_info: `${API_PROTECTED}/my-maps/edit`, 16 17 }, 17 18 room_types: { … … 34 35 navigate: `${API_PUBLIC}/navigate`, 35 36 add_favourite: `${API_PROTECTED}/favourites/add`, 37 add_report: `${API_PROTECTED}/reports/create`, 36 38 }, 37 39 favourites: { … … 43 45 login: `${API_AUTH}/login`, 44 46 register: `${API_AUTH}/register`, 45 verify: `${API_AUTH}/verify` 47 verify: `${API_AUTH}/verify`, 48 oauth: { 49 github: { 50 state: `${API_BASE_URL}/oauth/state`, 51 redirectUri : `${API_BASE_URL}/oauth/callback` 52 } 53 } 46 54 47 55 }, … … 50 58 load_pr: `${API_BASE_URL}/admin/load-pr`, 51 59 approve_pr: `${API_BASE_URL}/admin/pr/approve`, 52 deny_pr: `${API_BASE_URL}/admin/pr/deny` 60 deny_pr: `${API_BASE_URL}/admin/pr/deny`, 61 load_reports: `${API_BASE_URL}/admin/load-reports` 53 62 } 54 63 };
Note:
See TracChangeset
for help on using the changeset viewer.