forked from p15670423/monkey
UI: Use AuthComponent in VersionComponent
This commit is contained in:
parent
bfd0eb6fa5
commit
aa8e020df6
|
@ -2,8 +2,9 @@ import React from 'react';
|
||||||
|
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
import { faDownload } from '@fortawesome/free-solid-svg-icons/faDownload';
|
import { faDownload } from '@fortawesome/free-solid-svg-icons/faDownload';
|
||||||
|
import AuthComponent from '../AuthComponent';
|
||||||
|
|
||||||
class VersionComponent extends React.Component {
|
class VersionComponent extends AuthComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -14,7 +15,7 @@ class VersionComponent extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
fetch('/api/island/version') // This is not authenticated on purpose
|
this.authFetch('/api/island/version') // This is not authenticated on purpose
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -27,6 +28,7 @@ class VersionComponent extends React.Component {
|
||||||
|
|
||||||
newerVersionAvailable() {
|
newerVersionAvailable() {
|
||||||
const semverGt = require('semver/functions/gt');
|
const semverGt = require('semver/functions/gt');
|
||||||
|
console.log(this.state);
|
||||||
if(this.state.latestVersion !== undefined && this.state.versionNumber !== undefined) {
|
if(this.state.latestVersion !== undefined && this.state.versionNumber !== undefined) {
|
||||||
return semverGt(this.state.latestVersion, this.state.versionNumber);
|
return semverGt(this.state.latestVersion, this.state.versionNumber);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue