Skip to content

Commit a010711

Browse files
Clean up
1 parent 6d4668d commit a010711

File tree

10 files changed

+11
-40
lines changed

10 files changed

+11
-40
lines changed

src/components/links/TagNav.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ const TagNav :React.FC<TagList> = (tagList) => {
1616
<div className="list-group list-group-flush">
1717
{tagList.tags.map(tag => {
1818
return(
19-
<NavLink to={`/links?tag=${tag.name}`} key={tag.id}
20-
className="list-group-item list-group-item-action badge badge-primary"
21-
>
19+
<NavLink to={`/links?tag=${tag.name}`} key={tag.id} className={'pt-1 pb-1'}>
2220
<i className="fas fa-tag"/>&nbsp;
2321
<strong style={{"fontSize": "16px"}}><span>{tag.name}</span></strong>
2422
</NavLink>

src/models/LinkModels.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ export interface LinkModel {
33
id: number,
44
title: string,
55
url: string,
6-
tags: string[],
7-
description: string
6+
tags: string[]
87
}
98

109
export interface LinksModel {

src/pages/links/NewLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {LinkModel} from "../../models/LinkModels";
55

66
const NewLink = () => {
77
const linkService = new LinkService();
8-
let linkModel: LinkModel = {description: "", id: 0, tags: [], title: "", url: ""};
8+
let linkModel: LinkModel = {id: 0, tags: [], title: "", url: ""};
99
const [newLink, setNewLink] = useState(linkModel);
1010
const [tags, setTags] = useState("");
1111

src/services/AuthService.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import {loadState, saveState, cleanState} from "../store/localStorage";
2-
import axios from "./axios-config";
1+
import axios from "./AxiosConfig";
2+
import {cleanState, loadState, saveState} from "../store/LocalStorage";
33

44
export interface LoginUserModel {
5-
6-
access_token: string,
5+
access_token: string
76
user: UserModel
87
}
98

src/services/axios-config.ts renamed to src/services/AxiosConfig.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import axios from "axios";
2-
import { getAccessToken, cleanState } from "../store/localStorage";
2+
import { getAccessToken, cleanState } from "../store/LocalStorage";
33

44
const instance = axios.create();
55
const localApiUrl = "http://localhost:8080/api";
66

7-
let apiUrl = process.env.REACT_APP_API_BASE_URL;
8-
console.log("REACT_APP_API_BASE_URL from env: " + apiUrl);
9-
apiUrl = apiUrl || localApiUrl;
10-
console.log("Effective REACT_APP_API_BASE_URL from env: " + apiUrl);
7+
let apiUrl = process.env.REACT_APP_API_BASE_URL || localApiUrl;
8+
console.log("REACT_APP_API_BASE_URL : " + apiUrl);
119
instance.defaults.baseURL = apiUrl;
1210

13-
// Set the AUTH token for any request
1411
instance.interceptors.request.use(function(config) {
1512
const accessToken = getAccessToken();
1613
if (!config.headers.Authorization && accessToken) {
@@ -19,7 +16,6 @@ instance.interceptors.request.use(function(config) {
1916
return config;
2017
});
2118

22-
// Add a response interceptor
2319
instance.interceptors.response.use(
2420
function(response) {
2521
return response;

src/services/LinkService.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios from "./axios-config";
1+
import axios from "./AxiosConfig";
22
import {LinkModel} from "../models/LinkModels";
33

44
export default class LinkService {
@@ -17,10 +17,6 @@ export default class LinkService {
1717
return axios.get(url);
1818
}
1919

20-
fetchLinksByTag = (tag:string, page: number) => {
21-
return axios.get(`/links?tag=${tag}&page=${page}`);
22-
}
23-
2420
createLink = (link: LinkModel) => {
2521
return axios.post("/links", link);
2622
}

src/services/UserService.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1-
import axios from "./axios-config";
2-
3-
export interface UpdateUserModel {
4-
id: number
5-
name: string
6-
bio: string
7-
location: string
8-
githubUsername: string
9-
twitterUsername: string
10-
}
1+
import axios from "./AxiosConfig";
112

123
export default class AuthService {
134

145
performRegistration = (user: {}) => {
156
return axios.post("/users", user);
167
}
17-
18-
updateUserProfile = (user: UpdateUserModel) => {
19-
return axios.put("/user", user);
20-
}
21-
22-
getUserProfile = (id: number) => {
23-
return axios.get<UpdateUserModel>("/users/"+id);
24-
}
258
}

src/sloth.png

-143 KB
Binary file not shown.

src/space.jpg

-45.6 KB
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)