Skip to content

Commit 405495d

Browse files
committed
Call initial refresh
1 parent 28b85c5 commit 405495d

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "freenit",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"private": false,
55
"description": "Freenit framework",
66
"author": "Goran Mekić",

src/App.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { BrowserRouter as Router } from 'react-router-dom'
44
import { ThemeProvider } from '@material-ui/styles'
55
import { Style } from 'radium'
66

7-
import Routing from 'routing'
8-
import theme from 'theme'
9-
import styles from 'styles'
7+
import Routing from './routing'
8+
import styles from './styles'
9+
import theme from './theme'
10+
import { auth } from './auth'
11+
12+
13+
auth.init('/api/v0')
1014

1115

1216
const App = () => {

src/auth.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { rest } from './utils'
2+
3+
14
class Auth
25
{
36
access = { expire: null, date: null }
47
refresh = { expire: null, data: null }
58

6-
constructor() {
7-
this.refresh()
9+
init = async (api) => {
10+
window.rest = rest(api)
11+
window.rest.API_ROOT = api
12+
await this.refresh()
813
}
914

1015
login = async (email, password) => {

src/routing.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,10 @@ import {
1010
Landing,
1111
Role,
1212
User,
13-
rest,
14-
} from './lib'
15-
16-
17-
const API_ROOT = '/api/v0'
13+
} from './pages'
1814

1915

2016
const Routing = () => {
21-
window.rest = rest(API_ROOT)
22-
window.rest.API_ROOT = API_ROOT
2317
return (
2418
<Switch>
2519
<Route exact path="/" component={Landing.Detail} />

0 commit comments

Comments
 (0)