Skip to content

Commit ff37ab5

Browse files
author
Rajeev Kumar Singh
committed
Changed API Endpoints
1 parent 8911c9d commit ff37ab5

File tree

7 files changed

+43
-26
lines changed

7 files changed

+43
-26
lines changed

polling-app-client/src/constants/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export const API_BASE_URL = 'http://localhost:5000';
2-
//export const API_BASE_URL = 'https://polls.callicoder.com';
1+
export const API_BASE_URL = 'http://localhost:5000/api';
2+
//export const API_BASE_URL = 'https://polls.callicoder.com/api';
33
export const ACCESS_TOKEN = 'accessToken';
44

55
export const POLL_LIST_SIZE = 30;

polling-app-client/src/user/profile/Profile.css

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
margin-bottom: 44px;
33
padding-top: 40px;
44
padding-bottom: 20px;
5-
}
6-
7-
.user-avatar {
5+
margin: 0 auto;
86
text-align: center;
97
}
108

@@ -24,18 +22,34 @@
2422

2523
.user-summary {
2624
text-align: center;
25+
padding-top: 20px;
2726
}
2827

2928
@media (min-width: 576px) {
30-
.user-summary {
29+
.user-details {
3130
text-align: left;
31+
display: table;
3232
}
33+
34+
.user-avatar, .user-summary {
35+
float: left;
36+
text-align: left;
37+
}
38+
39+
.user-summary {
40+
padding-top: 0;
41+
padding-left: 40px;
42+
width: calc(100% - 120px);
43+
}
3344
}
3445

3546
.user-summary .full-name {
3647
font-size: 30px;
3748
font-weight: 600;
3849
color: rgba(0,0,0,0.85);
50+
text-overflow: ellipsis;
51+
overflow: hidden;
52+
white-space: nowrap;
3953
}
4054

4155
.user-summary .username {

polling-app-client/src/user/profile/Profile.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,22 @@ class Profile extends Component {
7979
<div className="profile">
8080
{
8181
this.state.user ? (
82-
<Row className="user-details">
83-
<Col xs={24} sm={8} md={9} className="user-avatar">
84-
<Avatar className="user-avatar-circle" style={{ backgroundColor: getAvatarColor(this.state.user.name)}}>
85-
{this.state.user.name[0].toUpperCase()}
86-
</Avatar>
87-
</Col>
88-
<Col xs={24} sm={16} md={15} className="user-summary">
89-
<div className="full-name">{this.state.user.name}</div>
90-
<div className="username">@{this.state.user.username}</div>
91-
<div className="user-joined">
92-
Joined {formatDate(this.state.user.joinedAt)}
82+
<div className="user-profile">
83+
<div className="user-details">
84+
<div className="user-avatar">
85+
<Avatar className="user-avatar-circle" style={{ backgroundColor: getAvatarColor(this.state.user.name)}}>
86+
{this.state.user.name[0].toUpperCase()}
87+
</Avatar>
9388
</div>
94-
</Col>
95-
<Col xs={24}>
89+
<div className="user-summary">
90+
<div className="full-name">{this.state.user.name}</div>
91+
<div className="username">@{this.state.user.username}</div>
92+
<div className="user-joined">
93+
Joined {formatDate(this.state.user.joinedAt)}
94+
</div>
95+
</div>
96+
</div>
97+
<div className="user-poll-details">
9698
<Tabs defaultActiveKey="1"
9799
animated={false}
98100
tabBarStyle={tabBarStyle}
@@ -105,8 +107,8 @@ class Profile extends Component {
105107
<PollList username={this.props.match.params.username} type="USER_VOTED_POLLS" />
106108
</TabPane>
107109
</Tabs>
108-
</Col>
109-
</Row>
110+
</div>
111+
</div>
110112
): null
111113
}
112114
</div>

polling-app-server/src/main/java/com/example/polls/config/SecurityConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ protected void configure(HttpSecurity http) throws Exception {
8686
"/**/*.css",
8787
"/**/*.js")
8888
.permitAll()
89-
.antMatchers("/auth/**")
89+
.antMatchers("/api/auth/**")
9090
.permitAll()
91-
.antMatchers("/user/checkUsernameAvailability", "/user/checkEmailAvailability")
91+
.antMatchers("/api/user/checkUsernameAvailability", "/api/user/checkEmailAvailability")
9292
.permitAll()
93-
.antMatchers(HttpMethod.GET, "/polls/**", "/users/**")
93+
.antMatchers(HttpMethod.GET, "/api/polls/**", "/api/users/**")
9494
.permitAll()
9595
.anyRequest()
9696
.authenticated();

polling-app-server/src/main/java/com/example/polls/controller/AuthController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Created by rajeevkumarsingh on 02/08/17.
3434
*/
3535
@RestController
36-
@RequestMapping("/auth")
36+
@RequestMapping("/api/auth")
3737
public class AuthController {
3838

3939
@Autowired

polling-app-server/src/main/java/com/example/polls/controller/PollController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333

3434
@RestController
35-
@RequestMapping("/polls")
35+
@RequestMapping("/api/polls")
3636
public class PollController {
3737

3838
@Autowired

polling-app-server/src/main/java/com/example/polls/controller/UserController.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.springframework.web.bind.annotation.*;
1818

1919
@RestController
20+
@RequestMapping("/api")
2021
public class UserController {
2122

2223
@Autowired

0 commit comments

Comments
 (0)