This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getUser } from "../src/graphql/queries"; | |
import {withSSRContext} from "aws-amplify"; | |
export async function getServerSideProps({ req, res }) { | |
const { Auth, API } = withSSRContext({ req }); | |
try { | |
const user = await Auth.currentAuthenticatedUser(); | |
const response = await API.graphql({ | |
query: getUser, | |
variables: { id: user.attributes.sub }, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const submitHandler = async (event) => { | |
event.preventDefault(); | |
const currentUser = await Auth.currentAuthenticatedUser(); | |
try { | |
const result = await API.graphql({ | |
query: createUser, | |
variables: { | |
input: { | |
id: currentUser.attributes.sub, | |
firstName: firstName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import { Form } from "react-bootstrap"; | |
import { createUser, updateUser } from "../src/graphql/mutations"; | |
import { API } from "@aws-amplify/api"; | |
import { Auth } from "@aws-amplify/auth"; | |
import Navbar from "../components/Navbar"; | |
const EditUser = () => { | |
const [firstName, setFirstName] = useState(''); | |
const [secondName, setSecondName] = useState(''); | |
const [description, setDescription] = useState(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User @model { | |
id: ID! | |
firstName: String | |
lastName: String | |
description: "String" | |
image: String | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import Head from "next/head"; | |
import Navbar from "../components/Navbar"; | |
export default function Home() { | |
return ( | |
<div className="w-100 h-100 d-flex flex-column justify-content-start"> | |
<Head> | |
<title>Profile App</title> | |
<link rel="icon" href="/favicon.ico" /> | |
</Head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Amplify } from "aws-amplify"; | |
import { AmplifyAuthenticator } from "@aws-amplify/ui-react"; | |
import awsExports from "../src/aws-exports"; | |
import "../styles/globals.css"; | |
Amplify.configure({ ...awsExports, ssr: true }); | |
function MyApp({ Component, pageProps }) { | |
return ( | |
<AmplifyAuthenticator> | |
<Component {...pageProps} /> | |
</AmplifyAuthenticator> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body: | |
AnimatedBuilder(animation: _slideAnimation, | |
builder: (ctx, ch) => Container( | |
width: 100, | |
height: 100, | |
margin: EdgeInsets.only( | |
top: _slideAnimation.value, | |
left: 125 | |
), | |
decoration: BoxDecoration( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AnimationController _controller; | |
Animation<double> _slideAnimation; | |
@override | |
void initState() { | |
// TODO: implement initState | |
super.initState(); | |
_controller = AnimationController( | |
vsync: this, | |
duration: Duration(milliseconds: 1000), |