Skip to content

Commit fa08a33

Browse files
committed
add missing files
1 parent 8ddcdc3 commit fa08a33

File tree

15 files changed

+147
-0
lines changed

15 files changed

+147
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
3+
import { Grid, Col, Row, Popover, ButtonToolbar, Button } from 'react-bootstrap';
4+
import { ERROR_TEXT, REPOSITORY_URL } from '../utils/constants';
5+
6+
export class Error extends React.Component<RouteComponentProps<any>, any> {
7+
public render() {
8+
return (
9+
<Grid>
10+
<Row className="show-grid">
11+
<Col xs={6} md={4}>
12+
<div>
13+
<img src="baby-cow.jpg" alt="Baby Cow" />
14+
</div>
15+
</Col>
16+
<Col xs={12} md={8}>
17+
<div style={{ height: 120 }}>
18+
<Popover
19+
id="popover-basic"
20+
placement="right"
21+
positionTop={50}
22+
title="Oops!">
23+
{ERROR_TEXT}
24+
<ButtonToolbar>
25+
<Button href={REPOSITORY_URL} target="_blank">help me</Button>
26+
<Button href='/'>ignore me</Button>
27+
</ButtonToolbar>
28+
</Popover>
29+
</div>
30+
</Col>
31+
</Row>
32+
</Grid>
33+
);
34+
}
35+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as React from 'react';
2+
import { RouteComponentProps } from 'react-router';
3+
4+
export class Example extends React.Component<RouteComponentProps<{}>, {}> {
5+
public render() {
6+
return (
7+
<h3>This is an example page.</h3>
8+
);
9+
}
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as React from 'react';
2+
3+
export class Footer extends React.Component<{}, {}> {
4+
public render() {
5+
return (
6+
<footer>ASP.NET Core ReactJS - Example &copy; 2018</footer>
7+
);
8+
}
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import 'isomorphic-fetch';
2+
import { removeAccessToken } from '../../utils/helpers';
3+
4+
export function logout() {
5+
fetch('/api/users/logout')
6+
.then(res => {
7+
if (res.status >= 200 && res.status < 300) {
8+
// Remove token of logged in user from local storage
9+
removeAccessToken();
10+
window.location.hash = '/';
11+
} else {
12+
window.location.hash = '/error';
13+
}
14+
});
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.about {
2+
display: block;
3+
margin-top: 200px;
4+
margin-left: auto;
5+
margin-right: auto;
6+
width: 50%;
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.img-with-text {
2+
text-align: justify;
3+
width: 100%;
4+
}
5+
6+
.img-with-text img {
7+
display: block;
8+
margin: 0 auto;
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.home {
2+
display: block;
3+
margin-top: 200px;
4+
margin-left: auto;
5+
margin-right: auto;
6+
width: 50%;
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.loading {
2+
display: block;
3+
margin: auto;
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.users h2 {
2+
text-align: center;
3+
}

ASPNETCoreReactJS-Example/ASPNETCoreReactJS-Example/ClientApp/utils/constants.js

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const ERROR_TEXT = "Something is wrong. But, you see, I'm just a baby, so I can't deal with everything in this cruel world! You wanna help me ?";
2+
3+
export const REPOSITORY_URL = "https://github.com/mdamyanova/ASP.NET-Core-ReactJS-Example";

ASPNETCoreReactJS-Example/ASPNETCoreReactJS-Example/ClientApp/utils/helpers.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ASPNETCoreReactJS-Example/ASPNETCoreReactJS-Example/ClientApp/utils/helpers.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const storage = window.localStorage;
2+
3+
export const getAccessToken = () => storage.getItem("access_token");
4+
5+
export const getUser = () => storage.getItem("user");
6+
7+
export const setUser = (user: any) => storage.setItem("user", user);
8+
9+
export const setAccessToken = (token: any) => storage.setItem("access_token", token);
10+
11+
export const removeAccessToken = () => storage.removeItem("access_token");
12+
13+
export const isLoggedIn = () => Boolean(getAccessToken());
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace ASPNETCoreReactJS_Example.Models
2+
{
3+
public class LoginModel
4+
{
5+
public string UserName { get; set; }
6+
7+
public string Password { get; set; }
8+
}
9+
}

0 commit comments

Comments
 (0)