docs: 🐛 remove spinner causing css issue + add NProgress
Signed-off-by: jffarge <jf@dagger.io>
This commit is contained in:
parent
5ae7ce293c
commit
472750540c
@ -27,6 +27,7 @@
|
|||||||
"docusaurus-plugin-sass": "^0.2.1",
|
"docusaurus-plugin-sass": "^0.2.1",
|
||||||
"docusaurus2-dotenv": "^1.4.0",
|
"docusaurus2-dotenv": "^1.4.0",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
|
"nprogress": "^0.2.0",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-social-login-buttons": "^3.5.1",
|
"react-social-login-buttons": "^3.5.1",
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import qs from 'querystringify';
|
import qs from 'querystringify';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
|
import NProgress from "nprogress";
|
||||||
|
|
||||||
import { checkUserCollaboratorStatus } from '../api/github'
|
import { checkUserCollaboratorStatus } from '../api/github'
|
||||||
import Spinner from './Spinner';
|
|
||||||
import DocPageAuthentication from './DocPageAuthentication';
|
import DocPageAuthentication from './DocPageAuthentication';
|
||||||
import DocPageRedirect from './DocPageRedirect';
|
import DocPageRedirect from './DocPageRedirect';
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ function DocPageCustom({ location, userAccessStatus, setUserAccessStatus }) {
|
|||||||
const authQuery = qs.parse(location.search);
|
const authQuery = qs.parse(location.search);
|
||||||
|
|
||||||
useEffect(async () => {
|
useEffect(async () => {
|
||||||
|
NProgress.start()
|
||||||
if (!isEmpty(authQuery) && userAccessStatus === null) { //callback after successful auth with github
|
if (!isEmpty(authQuery) && userAccessStatus === null) { //callback after successful auth with github
|
||||||
const user = await checkUserCollaboratorStatus(authQuery.code);
|
const user = await checkUserCollaboratorStatus(authQuery.code);
|
||||||
setUserAccessStatus(user)
|
setUserAccessStatus(user)
|
||||||
@ -19,10 +21,11 @@ function DocPageCustom({ location, userAccessStatus, setUserAccessStatus }) {
|
|||||||
window.localStorage.setItem('user', JSON.stringify(user));
|
window.localStorage.setItem('user', JSON.stringify(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setIsLoading(false)
|
NProgress.done();
|
||||||
|
setIsLoading(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
if (isLoading) return <Spinner />
|
if(isLoading) return <p>...</p>
|
||||||
|
|
||||||
if (userAccessStatus?.permission === false) {
|
if (userAccessStatus?.permission === false) {
|
||||||
return <DocPageRedirect />
|
return <DocPageRedirect />
|
||||||
|
Reference in New Issue
Block a user