This file contains 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 ContentLoader from "./ContentLoader"; | |
import { useParams } from "react-router-dom"; | |
export default ({ userId }) => { | |
let { id } = useParams(); | |
const getUserDetail = async () => { | |
return await ( |
This file contains 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 ContentLoader from "./ContentLoader"; | |
import { Link } from "react-router-dom"; | |
export default () => { | |
const getUsers = async () => { | |
return await (await fetch("https://reqres.in/api/users?delay=1")).json(); | |
}; | |
return ( |
This file contains 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"; | |
export default ({ render, getContent }) => { | |
const [loading, setLoading] = React.useState(false); | |
const [content, setContent] = React.useState(null); | |
React.useEffect(() => { | |
async function load(){ | |
setLoading(true); |
This file contains 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
INSTALLED_APPS = [ | |
... | |
'rest_framework', | |
'rest_framework.authtoken' | |
] |
This file contains 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
from django.conf import settings | |
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from rest_framework.authtoken.models import Token | |
@receiver(post_save, sender=settings.AUTH_USER_MODEL) | |
def create_auth_token(sender, instance=None, created=False, **kwargs): | |
if created: | |
Token.objects.create(user=instance) |