mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-12-01 18:07:00 +00:00
19 lines
647 B
TypeScript
19 lines
647 B
TypeScript
import { useEffect, useState } from "react";
|
|
import { GenerateTokenResponse } from "../Contracts/DataModels";
|
|
import AuthHeadersUtil from "../Platform/Hosted/Authorization";
|
|
|
|
export function useFullScreenURLs(): GenerateTokenResponse | undefined {
|
|
const [state, setState] = useState<GenerateTokenResponse>();
|
|
|
|
useEffect(() => {
|
|
Promise.all([AuthHeadersUtil.generateEncryptedToken(), AuthHeadersUtil.generateEncryptedToken(true)]).then(
|
|
([readWriteResponse, readOnlyResponse]) =>
|
|
setState({
|
|
readWrite: readWriteResponse.readWrite,
|
|
read: readOnlyResponse.read,
|
|
})
|
|
);
|
|
}, []);
|
|
return state;
|
|
}
|