fix(bitbucket): fix rebasing mistakes in bitbucket backend and deps (#1522)
This commit is contained in:
parent
6eb86957d0
commit
bdfd9443db
@ -1,6 +1,6 @@
|
||||
import { flow } from "lodash";
|
||||
import { flow, has } from "lodash";
|
||||
import {
|
||||
LocalForage,
|
||||
localForage,
|
||||
unsentRequest,
|
||||
responseParser,
|
||||
then,
|
||||
@ -67,13 +67,13 @@ export default class API {
|
||||
|
||||
readFile = async (path, sha, { ref = this.branch, parseText = true } = {}) => {
|
||||
const cacheKey = parseText ? `bb.${ sha }` : `bb.${ sha }.blob`;
|
||||
const cachedFile = sha ? await LocalForage.getItem(cacheKey) : null;
|
||||
const cachedFile = sha ? await localForage.getItem(cacheKey) : null;
|
||||
if (cachedFile) { return cachedFile; }
|
||||
const result = await this.request({
|
||||
url: `${ this.repoURL }/src/${ ref }/${ path }`,
|
||||
cache: "no-store",
|
||||
}).then(parseText ? responseParser({ format: "text" }) : responseParser({ format: "blob" }));
|
||||
if (sha) { LocalForage.setItem(cacheKey, result); }
|
||||
if (sha) { localForage.setItem(cacheKey, result); }
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,12 @@ export default class BitbucketAuthenticationPage extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { inProgress } = this.props;
|
||||
|
||||
return (
|
||||
<AuthenticationPage
|
||||
onLogin={this.handleLogin}
|
||||
loginDisabled={this.props.inProgress}
|
||||
loginDisabled={inProgress}
|
||||
loginErrorMessage={this.state.loginError}
|
||||
renderButtonContent={() => (
|
||||
<React.Fragment>
|
||||
|
@ -81,7 +81,7 @@ export default class Bitbucket {
|
||||
base_url: this.base_url,
|
||||
site_id: this.site_id,
|
||||
};
|
||||
this.authenticator = new Authenticator(cfg);
|
||||
this.authenticator = new NetlifyAuthenticator(cfg);
|
||||
}
|
||||
|
||||
this.refreshedTokenPromise = this.authenticator.refresh({ provider: "bitbucket", refresh_token: this.refreshToken })
|
||||
|
@ -147,8 +147,6 @@ export default class GitGatewayAuthenticationPage extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
console.log('returning');
|
||||
|
||||
return (
|
||||
<AuthenticationPage renderPageContent={() => (
|
||||
<AuthForm onSubmit={this.handleLogin}>
|
||||
|
@ -113,7 +113,6 @@ export default class GitGateway {
|
||||
requestFunction: this.requestFunction,
|
||||
hasWriteAccess: async () => true,
|
||||
});
|
||||
console.log(this.api);
|
||||
this.backend = new BitBucketBackend(this.config, { proxied: true, API: this.api });
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ class Authenticator {
|
||||
cb(null, data);
|
||||
}
|
||||
if (e.data.indexOf('authorization:' + options.provider + ':error:') === 0) {
|
||||
console.log('Got authorization error');
|
||||
const err = JSON.parse(e.data.match(new RegExp('^authorization:' + options.provider + ':error:(.+)$'))[1]);
|
||||
window.removeEventListener('message', fn, false);
|
||||
this.authWindow.close();
|
||||
|
@ -5,3 +5,4 @@ export localForage from './localForage';
|
||||
export { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
|
||||
export { filterPromises, resolvePromiseProperties, then } from './promise';
|
||||
export unsentRequest from './unsentRequest';
|
||||
export { filterByPropExtension, parseResponse, responseParser } from './backendUtil';
|
||||
|
@ -37,7 +37,6 @@ const AuthenticationPage = ({
|
||||
renderButtonContent,
|
||||
renderPageContent,
|
||||
}) => {
|
||||
console.log(renderPageContent);
|
||||
return (
|
||||
<StyledAuthenticationPage>
|
||||
<PageLogoIcon size="300px" type="netlify-cms"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user