Skip to content

Commit 5e856b3

Browse files
feat(ui): add 403 signout handler to new api requests, upgrade to oats 0.5.0
1 parent 36faf72 commit 5e856b3

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ui/src/api/.openapi-generator/VERSION
4343
ui/src/api/git_push.sh
4444

4545
# UI generated typescript types
46-
ui/src/client/index.ts
46+
ui/src/client/generatedRoutes.ts
4747

4848
http/swagger_gen.go
4949

ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
"tsc:cypress": "tsc -p ./cypress/tsconfig.json --noEmit --pretty --skipLibCheck",
3838
"cy": "CYPRESS_baseUrl=http://localhost:9999 cypress open",
3939
"cy:dev": "CYPRESS_baseUrl=http://localhost:8080 cypress open",
40-
"generate": "oats ../http/swagger.yml > src/client/index.ts"
40+
"generate": "oats ../http/swagger.yml > src/client/generatedRoutes.ts"
4141
},
4242
"author": "",
4343
"devDependencies": {
4444
"@babel/core": "^7.5.5",
4545
"@babel/preset-env": "^7.5.5",
4646
"@cypress/webpack-preprocessor": "^4.0.3",
47-
"@influxdata/oats": "0.4.0",
47+
"@influxdata/oats": "0.5.0",
4848
"@types/chroma-js": "^1.3.4",
4949
"@types/codemirror": "^0.0.56",
5050
"@types/d3-color": "^1.2.1",

ui/src/client/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {setResponseHandler, postSignout} from './generatedRoutes'
2+
3+
setResponseHandler((status, headers, data) => {
4+
if (status === 403) {
5+
postSignout({})
6+
window.location.href = '/signin'
7+
}
8+
9+
return {status, headers, data}
10+
})
11+
12+
export * from './generatedRoutes'

ui/yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -1107,10 +1107,10 @@
11071107
resolved "https://registry.yarnpkg.com/@influxdata/influxdb-templates/-/influxdb-templates-0.9.0.tgz#d4b1f727c8949147d2ade63f5754425a0d1a0e9d"
11081108
integrity sha512-R/QhYJz+nNPGT8LkWHXKOLYYUROavDPfIFoGP7sIrxhStjm+hb0TzHYeQ75HLPQqKh54zCB8cv/TINwRgijYBw==
11091109

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

0 commit comments

Comments
 (0)