Skip to content

Instantly share code, notes, and snippets.

View rayashi's full-sized avatar
🤓

Beto Coder rayashi

🤓
  • @beto.coder
View GitHub Profile
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 (
@rayashi
rayashi / UserList.js
Last active May 10, 2020 23:38
UserList
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 (
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);
INSTALLED_APPS = [
...
'rest_framework',
'rest_framework.authtoken'
]
@rayashi
rayashi / signals.py
Last active August 11, 2019 23:06
Catching post_save signal to create a token
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)