Skip to content

Commit

Permalink
feat(ui): add 403 signout handler to new api requests, upgrade to oat…
Browse files Browse the repository at this point in the history
…s 0.5.0
  • Loading branch information
hoorayimhelping committed Oct 15, 2019
1 parent e68bd45 commit e84d43f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ui/src/api/.openapi-generator/VERSION
ui/src/api/git_push.sh

# UI generated typescript types
ui/src/client/index.ts
ui/src/client/generatedRoutes.ts

http/swagger_gen.go

Expand Down
4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
"tsc:cypress": "tsc -p ./cypress/tsconfig.json --noEmit --pretty --skipLibCheck",
"cy": "CYPRESS_baseUrl=http://localhost:9999 cypress open",
"cy:dev": "CYPRESS_baseUrl=http://localhost:8080 cypress open",
"generate": "oats ../http/swagger.yml > src/client/index.ts"
"generate": "oats ../http/swagger.yml > src/client/generatedRoutes.ts"
},
"author": "",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@cypress/webpack-preprocessor": "^4.0.3",
"@influxdata/oats": "0.4.0",
"@influxdata/oats": "0.5.0",
"@types/chroma-js": "^1.3.4",
"@types/codemirror": "^0.0.56",
"@types/d3-color": "^1.2.1",
Expand Down
12 changes: 12 additions & 0 deletions ui/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {setResponseHandler, postSignout} from './generatedRoutes'

setResponseHandler((status, headers, data) => {
if (status === 403) {
postSignout({})
window.location.href = '/signin'
}

return {status, headers, data}
})

export * from './generatedRoutes'
8 changes: 4 additions & 4 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1107,10 +1107,10 @@
resolved "https://registry.yarnpkg.com/@influxdata/influxdb-templates/-/influxdb-templates-0.9.0.tgz#d4b1f727c8949147d2ade63f5754425a0d1a0e9d"
integrity sha512-R/QhYJz+nNPGT8LkWHXKOLYYUROavDPfIFoGP7sIrxhStjm+hb0TzHYeQ75HLPQqKh54zCB8cv/TINwRgijYBw==

"@influxdata/oats@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@influxdata/oats/-/oats-0.4.0.tgz#709b288232473140802fd1a3871f9b0f7ae49fc2"
integrity sha512-VgzO2jU0UguGFmdBEuqMM7jQS9soW0pqj251LmLKQhlFbuL9AKCAIOO6rf6OFqC3sCloduxwgZRc+Y9EprQhmQ==
"@influxdata/oats@0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@influxdata/oats/-/oats-0.5.0.tgz#0fdd308524fa407303ffa6a3d60fe959777dcfcb"
integrity sha512-oBlSB5ROM6JMqsVBDLlJzkBiMvAom+b4dszH83LPdM9H+pUtj2SeUoMpQhj9/4ioCnUVZx8HFN58/a/pkmADAQ==
dependencies:
commander "^2.20.0"
humps "^2.0.1"
Expand Down

0 comments on commit e84d43f

Please sign in to comment.