Skip to content

Commit 54aff1b

Browse files
author
Emile Frey
committed
added some interfaces - minor changes
1 parent 6fa291e commit 54aff1b

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default interface PageResponse<T> {
2+
count: number,
3+
next: string,
4+
previous: string,
5+
results: T[]
6+
}
7+
8+
export interface Response<T> {
9+
data: T,
10+
status: number,
11+
statusText: string,
12+
config: object
13+
};

frontend/src/routes/PrivateRoute.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@ import { Route, Redirect } from "react-router-dom";
33
import { Children } from "../interfaces/Children"
44

55
export interface PrivateRouteProps {
6-
isAuthenticated: boolean
7-
children: Children
8-
exact: boolean
9-
path: string
6+
isAuthenticated: boolean
7+
children: Children
8+
exact: boolean
9+
path: string
1010
}
1111

1212
// A wrapper for <Route> that redirects to the login screen if you're not yet authenticated.
13-
export default function PrivateRoute({ isAuthenticated, children, ...rest}: PrivateRouteProps) {
14-
return (
15-
<Route
16-
{...rest}
17-
render={({ location }) =>
13+
export default function PrivateRoute({ isAuthenticated, children, ...rest }: PrivateRouteProps) {
14+
return (
15+
<Route
16+
{...rest}
17+
render={({ location }) =>
1818
isAuthenticated ? (
19-
children
20-
) : (
19+
children
20+
) : (
2121
<Redirect
2222
to={{
2323
pathname: "/login/",
2424
state: { from: location }
2525
}}
2626
/>
2727
)
28-
}
29-
/>
30-
);
31-
}
28+
}
29+
/>
30+
);
31+
}

0 commit comments

Comments
 (0)