Merge branch 'master' into v0.3.0

Conflicts:
	docs/objects.inv
	docs/searchindex.js
	fittrackee_api/poetry.lock
	fittrackee_api/pyproject.toml
	fittrackee_client/src/actions/index.js
	fittrackee_client/src/components/App.jsx
	fittrackee_client/src/utils/index.js
This commit is contained in:
Sam
2020-02-07 11:12:32 +01:00
55 changed files with 827 additions and 1091 deletions

View File

@ -0,0 +1,35 @@
const updatePath = (toPath, newPath) => {
if (typeof toPath === 'string' || toPath instanceof String) {
toPath = newPath
} else {
toPath.pathname = newPath
}
return toPath
}
const pathInterceptor = toPath => {
if (
!window.localStorage.authToken &&
!['/login', '/register'].includes(toPath.pathname)
) {
toPath = updatePath(toPath, '/login')
}
if (
window.localStorage.authToken &&
['/login', '/register'].includes(toPath.pathname)
) {
toPath = updatePath(toPath, '/')
}
return toPath
}
export const historyEnhancer = originalHistory => {
originalHistory.location = pathInterceptor(originalHistory.location)
return {
...originalHistory,
push: (path, ...args) =>
originalHistory.push(pathInterceptor(path), ...args),
replace: (path, ...args) =>
originalHistory.replace(pathInterceptor(path), ...args),
}
}

View File

@ -15,7 +15,7 @@ export const getFileSizeInMB = fileSize => {
return (!fileSize && 0) || +value.toFixed(2)
}
export const version = '0.2.4-beta' // version stored in 'utils' for now
export const version = '0.2.5-beta' // version stored in 'utils' for now
export const apiUrl = `${process.env.REACT_APP_API_URL}/api/`
/* prettier-ignore */
export const thunderforestApiKey = `${