export function OnBehalfOfUserTabContents()

in kotlin/app-homepage-react/client/src/app/components/OnBehalfOfUserTabContents.tsx [12:42]


export function OnBehalfOfUserTabContents() {
    const state = useState(() => loadInitialTabState());

    if (state.promised) {
        return (<Loader/>);
    }

    return (
        <>
            {
                state.userTokenData.get() === undefined &&
                <WarningBox text="Authorize the app to view channels and send messages on behalf of the current user"
                            isActionable={true}
                            onAction={() => requestUserToken(
                                true,
                                userPermissionScope,
                                (newUserTokenData) => state.userTokenData.set(newUserTokenData)
                            )}
                />
            }
            <AppTabContents
                key="OnBehalfOfTheUser"
                userTokenData={state.userTokenData.get()}
                apiImpl={onBehalfOfTheUserApiImpl}
                implementationNote="HTTP requests are made from the iframe to Space API with a user access token."
                sourceCodeHRef="https://github.com/JetBrains/space-app-tutorials/blob/main/kotlin/app-homepage-react/client/src/app/service/onBehalfOfTheUserApiImpl.ts"
                sourceCodeLinkText="onBehalfOfTheUserApiImpl.ts"
            />
        </>
    )
}