File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers > => {
2
- const [token, username, password, additionalHeaders] = await Promise.all([
2
+ let [token, username, password, additionalHeaders] = await Promise.all([
3
3
resolve(options, config.TOKEN),
4
4
resolve(options, config.USERNAME),
5
5
resolve(options, config.PASSWORD),
6
6
resolve(options, config.HEADERS),
7
7
]);
8
8
9
+ if (!isStringWithValue(token)) {
10
+ const SESSION_KEY = '_anyroad_embedded_session_key';
11
+ token = document?.cookie?.split('; ').find(row => row.startsWith(`${SESSION_KEY}=`))?.split('=')[1];
12
+ }
13
+
9
14
const headers = Object.entries({
10
15
Accept: 'application/json',
11
16
...additionalHeaders,
You can’t perform that action at this time.
0 commit comments