All files / src App.tsx

87.5% Statements 7/8
100% Branches 4/4
50% Functions 1/2
87.5% Lines 7/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                    1x     7x   6x 1x           6x 1x           5x              
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
 
import {applyDensity, Density} from "@cloudscape-design/global-styles";
import {useContext} from "react";
import {UserContext} from "./components/context";
import Auth from "@aws-amplify/auth";
import CustomAppLayout from "./components/layout";
import {Spinner} from "@cloudscape-design/components";
 
applyDensity(Density.Comfortable)
 
function App() {
    const {user} = useContext(UserContext)
 
    if (!user) {
        Auth.federatedSignIn().catch((error) => {
            console.error(error);
        })
    }
 
 
    if (!user)
        return <>
            <Spinner></Spinner>
            <div>Redirecting to login...</div>
        </>
 
    else {
        return (
            <CustomAppLayout/>
        )
    }
}
 
export default App