export function OnBehalfOfAppTabContents()

in kotlin/app-homepage-react/client/src/app/components/OnBehalfOfAppTabContents.tsx [19:52]


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

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

    return (
        <>
            {
                !state.appHasPermissions.get() &&
                <WarningBox text="Authorize the app to view channels and send messages on behalf of itself"
                            isActionable={true}
                            onAction={() => requestAppPermissions(
                                appPermissionScope,
                                (success: boolean) => {
                                    if (success) {
                                        state.appHasPermissions.set(true);
                                    }
                                }
                            )}
                />
            }
            <AppTabContents
                key="OnBehalfOfTheApp"
                userTokenData={state.userTokenData.get()}
                apiImpl={onBehalfOfTheAppApiImpl}
                implementationNote="HTTP requests are made from the iframe to the app server, which then makes requests to Space with application access token."
                sourceCodeHRef="https://github.com/JetBrains/space-app-tutorials/blob/main/kotlin/app-homepage-react/client/src/app/service/onBehalfOfTheAppApiImpl.ts"
                sourceCodeLinkText="onBehalfOfTheAppApiImpl.ts"
            />
        </>
    )
}