2018-10-15 16:45:54 +02:00
|
|
|
// @flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
2018-10-25 14:03:45 +02:00
|
|
|
import { apiClient } from "../../../../../../scm-ui-components/packages/ui-components/src/index";
|
2018-10-15 16:45:54 +02:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
t: string => string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type State = {
|
|
|
|
|
content: string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SourcecodeViewer extends React.Component<Props, State> {
|
|
|
|
|
constructor(props: Props) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
|
content: ""
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {}
|
|
|
|
|
|
|
|
|
|
render() {
|
2018-10-25 14:03:45 +02:00
|
|
|
return "sourceCodeViewer";
|
2018-10-15 16:45:54 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getContent(url: string) {
|
|
|
|
|
return apiClient
|
|
|
|
|
.get(url)
|
|
|
|
|
.then(response => response.text())
|
|
|
|
|
.catch(err => {
|
|
|
|
|
return null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("repos")(SourcecodeViewer);
|