Skip to content

Commit f3ec711

Browse files
SCAL-202456-3 format code for consistency
1 parent fe965eb commit f3ec711

File tree

4 files changed

+27
-39
lines changed

4 files changed

+27
-39
lines changed

rest-api/typescript-sdk/react-rest-api/src/App.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,6 @@
165165
-webkit-box-orient: vertical;
166166
}
167167

168-
.copy-button {
169-
background: linear-gradient(45deg, #667eea, #764ba2);
170-
color: white;
171-
border: none;
172-
padding: 8px 12px;
173-
border-radius: 8px;
174-
cursor: pointer;
175-
font-size: 0.9rem;
176-
transition: all 0.2s ease;
177-
flex-shrink: 0;
178-
}
179-
180-
.copy-button:hover {
181-
transform: scale(1.05);
182-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
183-
}
184-
185168
.liveboard-id {
186169
display: flex;
187170
flex-direction: row;
@@ -251,11 +234,6 @@
251234
flex-direction: column;
252235
align-items: stretch;
253236
}
254-
255-
.copy-button {
256-
align-self: flex-end;
257-
margin-top: 8px;
258-
}
259237
}
260238

261239
@media (max-width: 480px) {

rest-api/typescript-sdk/react-rest-api/src/get-auth-token.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ let cachedTokenResponse: Token | null = null;
55

66
export const getCachedAuthToken = async () => {
77
// if token has 30s remaining, return cached token
8-
if (cachedTokenResponse && cachedTokenResponse.expiration_time_in_millis - Date.now() > 30 * 1000) {
8+
if (
9+
cachedTokenResponse &&
10+
cachedTokenResponse.expiration_time_in_millis - Date.now() > 30 * 1000
11+
) {
912
return cachedTokenResponse.token;
1013
}
1114
// fetch new token
@@ -20,4 +23,4 @@ export const getCachedAuthToken = async () => {
2023
const data = await response.json();
2124
cachedTokenResponse = data;
2225
return data.token;
23-
}
26+
};
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { StrictMode } from 'react'
2-
import { createRoot } from 'react-dom/client'
3-
import './index.css'
4-
import App from './App.tsx'
1+
import { StrictMode } from "react";
2+
import { createRoot } from "react-dom/client";
3+
import "./index.css";
4+
import App from "./App.tsx";
55

6-
createRoot(document.getElementById('root')!).render(
6+
createRoot(document.getElementById("root")!).render(
77
<StrictMode>
88
<App />
9-
</StrictMode>,
10-
)
9+
</StrictMode>
10+
);
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
import { ThoughtSpotRestApi, createBearerAuthenticationConfig } from "@thoughtspot/rest-api-sdk";
1+
import {
2+
ThoughtSpotRestApi,
3+
createBearerAuthenticationConfig,
4+
} from "@thoughtspot/rest-api-sdk";
25
import { THOUGHTSPOT_HOST } from "../constants";
36
import { getCachedAuthToken } from "../get-auth-token";
47

58
/**
69
* This will create a bearer authenticated client to connect to thoughtspot server
7-
*
10+
*
811
* @returns ThoughtSpotRestApi
912
*/
1013
let thoughtSpotClient: ThoughtSpotRestApi;
1114
export const getThoughtSpotClient = () => {
1215
if (!thoughtSpotClient) {
13-
const bearerConfig = createBearerAuthenticationConfig(THOUGHTSPOT_HOST, getCachedAuthToken , {
14-
additionalHeaders: {
15-
"Accept-Language": "ThoughtSpot-SDK",
16-
},
17-
});
16+
const bearerConfig = createBearerAuthenticationConfig(
17+
THOUGHTSPOT_HOST,
18+
getCachedAuthToken,
19+
{
20+
additionalHeaders: {
21+
"Accept-Language": "ThoughtSpot-SDK",
22+
},
23+
}
24+
);
1825
thoughtSpotClient = new ThoughtSpotRestApi(bearerConfig);
1926
}
2027
return thoughtSpotClient;
21-
}
28+
};

0 commit comments

Comments
 (0)