Skip to content

Commit d639a76

Browse files
committed
Discard intercepters
1 parent 40ec420 commit d639a76

File tree

1 file changed

+3
-47
lines changed

1 file changed

+3
-47
lines changed

site/src/contexts/ProxyContext.tsx

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -82,53 +82,9 @@ export const ProxyProvider: FC<PropsWithChildren> = ({ children }) => {
8282
// Everytime we get a new proxiesResponse, update the latency check
8383
// to each workspace proxy.
8484
useEffect(() => {
85-
const latencyAxios = axios.create()
86-
latencyAxios.interceptors.request.use((config) => {
87-
config.data = config.data || {}
88-
config.data.startTime = new Date()
89-
console.log("Hey kira", config, config.data)
90-
return config
91-
})
92-
93-
latencyAxios.interceptors.response.use(
94-
// Success 200
95-
(x) => {
96-
// Get elapsed time (in milliseconds)
97-
const end = new Date()
98-
x.config.data = {
99-
...x.config.data,
100-
...{
101-
endTime: end,
102-
responseTime: end.getTime() - x.config.data.requestStartedAt,
103-
},
104-
}
105-
return x
106-
},
107-
// Handle 4xx & 5xx responses
108-
(x) => {
109-
// Get elapsed time (in milliseconds)
110-
const end = new Date()
111-
x.config.data = x.config.data || {
112-
...x.config.data,
113-
...{
114-
endTime: end,
115-
responseTime: end.getTime() - x.config.data.requestStartedAt,
116-
},
117-
}
118-
return x
119-
},
120-
)
121-
122-
// AgentLatency.tsx for colors
123-
console.log("update workspace proxies", proxiesResp)
124-
latencyAxios
125-
.get<any>("/api/v2/users/authmethods")
126-
.then((resp) => {
127-
console.log("latency", resp)
128-
})
129-
.catch((err) => {
130-
console.log("latency error", err)
131-
})
85+
if (!proxiesResp) {
86+
return
87+
}
13288
}, [proxiesResp])
13389

13490
const setAndSaveProxy = (

0 commit comments

Comments
 (0)