Refractoring: Removed unnecessary component Reactview

This commit is contained in:
Leoh 2021-10-19 19:08:05 +05:30
parent 30dd6590ec
commit 0cd5fde19c
5 changed files with 9 additions and 21 deletions

12
main.js

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@
"build": "rollup --config rollup.config.js --environment BUILD:production"
},
"keywords": [],
"author": "",
"author": "Leonard and Ran",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^18.0.0",

View file

@ -1,8 +0,0 @@
import * as React from "react";
import App from "./view/App";
export default function ReactView(props: any){
return(
<App username={props.userID} apiToken={props.tokenAPI} plugin={props.plugin}/>
)
}

View file

@ -1,7 +1,7 @@
import { ItemView,WorkspaceLeaf } from "obsidian";
import * as React from "react";
import * as ReactDOM from "react-dom";
import ReactView from "./ReactView";
import App from "./view/App"
import HabiticaSync from "./main";
@ -27,7 +27,7 @@ export class HabiticaSyncView extends ItemView {
async onOpen() {
ReactDOM.render(
<ReactView userID = {this.plugin.settings.userID} tokenAPI = {this.plugin.settings.apiToken} plugin={this.plugin}/>,
<App plugin={this.plugin}/>,
this.containerEl.children[1]
)
}

View file

@ -11,8 +11,8 @@ let credentials = ""
class App extends React.Component<any,any> {
constructor(props: any) {
super(props)
username = this.props.username
credentials = this.props.apiToken
username = this.props.plugin.settings.userID
credentials = this.props.plugin.settings.apiToken
this.state = {
isLoaded: false,
user_data: {