Commit 493648c9 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

Less logging

parent d26bb495
...@@ -35,25 +35,25 @@ class Component extends PureComponent { ...@@ -35,25 +35,25 @@ class Component extends PureComponent {
fetchUserinfo() { fetchUserinfo() {
let endpoint = this.props.serverConfig.userinfo_endpoint; let endpoint = this.props.serverConfig.userinfo_endpoint;
console.error("Get userinfo from ", endpoint) // console.error("Get userinfo from ", endpoint)
this.props.httpRequestStart(endpoint) this.props.httpRequestStart(endpoint)
} }
fetchCustom() { fetchCustom() {
let endpoint = this.state.customEndpoint let endpoint = this.state.customEndpoint
console.error("Get data from ", endpoint) // console.error("Get data from ", endpoint)
this.props.httpRequestStart(endpoint) this.props.httpRequestStart(endpoint)
} }
preselect(key, event) { preselect(key, event) {
console.log("Key", key, "event", event) // console.log("Key", key, "event", event)
this.setState({customEndpoint: key}) this.setState({customEndpoint: key})
} }
renderDropdownButton() { renderDropdownButton() {
const i = "drpdwn" const i = "drpdwn"
const title = "Load preset URL" const title = "Load preset URL"
console.log("PROPOS", this.props) // console.log("PROPOS", this.props)
if (this.props.serverConfig && this.props.serverConfig.authorization_endpoint && this.props.serverConfig.authorization_endpoint === 'https://auth.dataporten.no/oauth/authorization') { if (this.props.serverConfig && this.props.serverConfig.authorization_endpoint && this.props.serverConfig.authorization_endpoint === 'https://auth.dataporten.no/oauth/authorization') {
let links = [] let links = []
if (this.props.serverConfig.userinfo_endpoint) { if (this.props.serverConfig.userinfo_endpoint) {
...@@ -76,7 +76,7 @@ class Component extends PureComponent { ...@@ -76,7 +76,7 @@ class Component extends PureComponent {
url: "https://" + res[1] + ".dataporten-api.no/", url: "https://" + res[1] + ".dataporten-api.no/",
title: "Dataporten APIGK " + res[1] title: "Dataporten APIGK " + res[1]
}) })
console.log(res) // console.log(res)
} }
}) })
let menuitems = links.map((link) => { let menuitems = links.map((link) => {
...@@ -95,7 +95,7 @@ class Component extends PureComponent { ...@@ -95,7 +95,7 @@ class Component extends PureComponent {
} }
render() { render() {
console.error("Component", this.props) // console.error("Component", this.props)
if (!this.props.token) { if (!this.props.token) {
return null return null
......
...@@ -31,7 +31,7 @@ class Component extends PureComponent { ...@@ -31,7 +31,7 @@ class Component extends PureComponent {
fetchUserinfo() { fetchUserinfo() {
let endpoint = this.props.serverConfig.userinfo_endpoint; let endpoint = this.props.serverConfig.userinfo_endpoint;
console.error("Get userinfo from ", endpoint) // console.error("Get userinfo from ", endpoint)
this.props.httpRequestStart(endpoint) this.props.httpRequestStart(endpoint)
} }
...@@ -55,7 +55,7 @@ class Component extends PureComponent { ...@@ -55,7 +55,7 @@ class Component extends PureComponent {
return null return null
} }
render() { render() {
console.error("Component", this.props) // console.error("Component", this.props)
if (!this.props.http) { if (!this.props.http) {
return ( return (
......
...@@ -16,25 +16,25 @@ class Component extends PureComponent { ...@@ -16,25 +16,25 @@ class Component extends PureComponent {
} }
discoveryStart(e) { discoveryStart(e) {
console.log("Setting hostname", this.state.hostname) // console.log("Setting hostname", this.state.hostname)
console.log(this.props) // console.log(this.props)
this.props.discoveryStart(this.state.hostname) this.props.discoveryStart(this.state.hostname)
} }
updateHostfield(e) { updateHostfield(e) {
console.log("Updating hostname to ", e.target.value) // console.log("Updating hostname to ", e.target.value)
this.setState({hostname: e.target.value}) this.setState({hostname: e.target.value})
} }
handleAlertDismiss() { handleAlertDismiss() {
console.error("TODO: Dismiss alert.") // console.error("TODO: Dismiss alert.")
// this.setState({hostname: e.target.value}) // this.setState({hostname: e.target.value})
} }
getErrorMessage() { getErrorMessage() {
if (this.props.serverError) { if (this.props.serverError) {
console.log(typeof this.props.serverError) // console.log(typeof this.props.serverError)
console.error(this.props.serverError) // console.error(this.props.serverError)
return ( return (
<Alert bsStyle="danger" onDismiss={this.handleAlertDismiss}> <Alert bsStyle="danger" onDismiss={this.handleAlertDismiss}>
<h4>Error performing OAuth Discovery</h4> <h4>Error performing OAuth Discovery</h4>
......
...@@ -23,7 +23,7 @@ class Component extends PureComponent { ...@@ -23,7 +23,7 @@ class Component extends PureComponent {
// search - Sets or returns the query portion of a URL // search - Sets or returns the query portion of a URL
var currentURL = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '' ) + '/callback' var currentURL = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '' ) + '/callback'
console.log("currentURL", currentURL) // console.log("currentURL", currentURL)
this.state = { this.state = {
clientId: "6233aedf-f08a-4112-9a1b-f33c3cd9b396", clientId: "6233aedf-f08a-4112-9a1b-f33c3cd9b396",
......
...@@ -32,7 +32,7 @@ class Component extends PureComponent { ...@@ -32,7 +32,7 @@ class Component extends PureComponent {
} }
render() { render() {
console.error("Component", this.props) // console.error("Component", this.props)
if (!this.props.token) { if (!this.props.token) {
return ( return (
......
...@@ -16,7 +16,7 @@ const API = { ...@@ -16,7 +16,7 @@ const API = {
// config.headers["original-token"] = token.access_token // config.headers["original-token"] = token.access_token
config.method = "GET" config.method = "GET"
config.mode = "cors" config.mode = "cors"
console.log("About to fetch", config) // console.log("About to fetch", config)
return fetch(url, config).then((response) => { return fetch(url, config).then((response) => {
if (response.ok) { if (response.ok) {
...@@ -25,11 +25,11 @@ const API = { ...@@ -25,11 +25,11 @@ const API = {
throw Error(response.statusText) throw Error(response.statusText)
}) })
.then((data) => { .then((data) => {
console.log("DATA", data) // console.log("DATA", data)
dispatch(actions.discovery.completed(data)) dispatch(actions.discovery.completed(data))
}) })
.catch((err) => { .catch((err) => {
console.error("ERROR Fetching API Discovery", err) // console.error("ERROR Fetching API Discovery", err)
dispatch(actions.discovery.completed(err)) dispatch(actions.discovery.completed(err))
}) })
} }
...@@ -46,7 +46,7 @@ const API = { ...@@ -46,7 +46,7 @@ const API = {
config.headers.Authorization = 'Bearer ' + state.token.access_token config.headers.Authorization = 'Bearer ' + state.token.access_token
config.method = "GET" config.method = "GET"
config.mode = "cors" config.mode = "cors"
console.log("About to fetch", config) // console.log("About to fetch", config)
let resp = null let resp = null
...@@ -70,7 +70,7 @@ const API = { ...@@ -70,7 +70,7 @@ const API = {
dispatch(actions.http.completed(r)) dispatch(actions.http.completed(r))
}) })
.catch((err) => { .catch((err) => {
console.error("ERROR Fetching API Discovery", err) // console.error("ERROR Fetching API Discovery", err)
dispatch(actions.http.completed(err)) dispatch(actions.http.completed(err))
}) })
} }
...@@ -78,10 +78,10 @@ const API = { ...@@ -78,10 +78,10 @@ const API = {
"authenticate": function(config) { "authenticate": function(config) {
return dispatch => { return dispatch => {
console.error("About to save config", JSON.stringify(config, undefined, 3)) // console.error("About to save config", JSON.stringify(config, undefined, 3))
dispatch(actions.serverConfig.save(config)) dispatch(actions.serverConfig.save(config))
console.error("About to authentication", JSON.stringify(config, undefined, 3)) // console.error("About to authentication", JSON.stringify(config, undefined, 3))
const jsoconfig = { const jsoconfig = {
providerID: "oauthPlay", providerID: "oauthPlay",
client_id: config.clientId, client_id: config.clientId,
...@@ -91,7 +91,7 @@ const API = { ...@@ -91,7 +91,7 @@ const API = {
} }
setTimeout(() => { setTimeout(() => {
console.error("JSOCONFIG", JSON.stringify(jsoconfig, undefined, 2)) // console.error("JSOCONFIG", JSON.stringify(jsoconfig, undefined, 2))
let opts = {} let opts = {}
if (config.response_type) { if (config.response_type) {
...@@ -105,7 +105,7 @@ const API = { ...@@ -105,7 +105,7 @@ const API = {
appJSO = new jso(jsoconfig) appJSO = new jso(jsoconfig)
appJSO.getToken((token) => { appJSO.getToken((token) => {
console.error("Got token, ayay", token) // console.error("Got token, ayay", token)
dispatch(actions.tokens.save(token)) dispatch(actions.tokens.save(token))
}, opts) }, opts)
}, 1000) }, 1000)
...@@ -123,7 +123,7 @@ const API = { ...@@ -123,7 +123,7 @@ const API = {
authorization: state.serverConfig.authorization_endpoint authorization: state.serverConfig.authorization_endpoint
// scopes: { request: ["userinfo"]} // scopes: { request: ["userinfo"]}
} }
console.error("About to logout with ", jsoconfig) // console.error("About to logout with ", jsoconfig)
appJSO = new jso(jsoconfig) appJSO = new jso(jsoconfig)
appJSO.wipeTokens() appJSO.wipeTokens()
dispatch(actions.tokens.save(null)) dispatch(actions.tokens.save(null))
...@@ -135,10 +135,10 @@ const API = { ...@@ -135,10 +135,10 @@ const API = {
var state = getState() var state = getState()
if (!state || !state.serverConfig || !state.serverConfig.clientId) { if (!state || !state.serverConfig || !state.serverConfig.clientId) {
console.error("CANNOT DO CALLBACK BECAUSE CLIENDIT is missing...", state) // console.error("CANNOT DO CALLBACK BECAUSE CLIENDIT is missing...", state)
return return
} }
console.error(". STATE STATE STATE ", state) // console.error(". STATE STATE STATE ", state)
const jsoconfig = { const jsoconfig = {
providerID: "oauthPlay", providerID: "oauthPlay",
client_id: state.serverConfig.clientId, client_id: state.serverConfig.clientId,
...@@ -146,10 +146,10 @@ const API = { ...@@ -146,10 +146,10 @@ const API = {
authorization: state.serverConfig.authorization_endpoint authorization: state.serverConfig.authorization_endpoint
// scopes: { request: ["userinfo"]} // scopes: { request: ["userinfo"]}
} }
console.error(". Initialising oauth callback", jsoconfig) // console.error(". Initialising oauth callback", jsoconfig)
appJSO = new jso(jsoconfig) appJSO = new jso(jsoconfig)
appJSO.callback(undefined, (token) => { appJSO.callback(undefined, (token) => {
console.error(" ====) (===== Got token, ayay", token) // console.error(" ====) (===== Got token, ayay", token)
dispatch(actions.tokens.save(token)) dispatch(actions.tokens.save(token))
}) })
} }
......
...@@ -71,7 +71,7 @@ export function processValues(defaults, uservalues) { ...@@ -71,7 +71,7 @@ export function processValues(defaults, uservalues) {
let item = { let item = {
type: null type: null
} }
console.log("Processing key", key) // console.log("Processing key", key)
if (defaults && defaults.hasOwnProperty(key)) { if (defaults && defaults.hasOwnProperty(key)) {
item.type = getType(defaults[key]) item.type = getType(defaults[key])
} else if (uservalues && uservalues.hasOwnProperty(key)) { } else if (uservalues && uservalues.hasOwnProperty(key)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment