Jump to content
McKay Development

Recommended Posts

Posted (edited)

I need add steam-api to my reacr prjct.First I'm running my project with npm start and then I launch steam-user with node steam-api.And when i import steam-user to my react prjct I receive this errorĀ https://imgur.com/4xqZZlb

My files:

Package.json:

{
"name": "steamx-app",
"author": "webif",
"description": "empty",
"main": "electron/main.js",
"version": "0.1.0",
"private": true,
"homepage": "./",
"scripts": {
"start": "nf start",
"steam-api": "node src/steam-api.js",
"react-start": "react-scripts start",
"electron-start": "node electron-wait-react",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"electron": "electron .",
"ebuild": "yarn build && node_modules/.bin/build"
},
"build": {
"productName": "steamX",
"appId": "com.steamx.app",
"extends": null,
"electronVersion": "2.0.4",
"files": [
"build/**/*",
"electron/*"
]
},
"dependencies": {
"electron-titlebar": "0.0.3",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4",
"readline": "^1.3.0",
"steam-user": "^3.27.1"
},
"devDependencies": {
"electron": "^2.0.4",
"electron-builder": "^20.19.2",
"foreman": "^3.0.1"
}
}

steam-api.js:

const SteamUser = require('steam-user')
var client = new SteamUser()

reactjs file:

import React, { Component } from 'react'
import LoginForm from './LoginForm'
import SteamGuardForm from './SteamGuardForm'
import '../../steam-api.js'

export default class Login extends Component {
state = {
accountName: "",
password: "",
steamGuardCode: ""
}

inputChangeHandler = (event) => {
this.setState({
[event.target.id]: event.target.value
})
}

loginHandler = () => {
// sessionStorage.setItem("promptSteamGuard", true)
}

render() {
return(
<div className="welcome-container">
<LoginForm
accountName={this.state.accountName}
password={this.state.password}
inputChange={this.inputChangeHandler}
tryLogin={this.loginHandler}
/>
<SteamGuardForm
steamGuardCode={this.state.steamGuardCode}
/>
</div>
)
}
}
Edited by johnnyJ

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...