broke af
This commit is contained in:
parent
f0f4494553
commit
83fdd5b79a
|
@ -30,7 +30,8 @@ services:
|
|||
context: ./server
|
||||
volumes:
|
||||
- ./server:/usr/src/server
|
||||
|
||||
ports:
|
||||
- 8000:8000
|
||||
environment:
|
||||
- DEBUG=true
|
||||
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||
|
|
|
@ -20,7 +20,7 @@ export const AppContextProvider = ({ children, baseURL }: Props) => {
|
|||
const api = axios.create({ baseURL })
|
||||
|
||||
api.interceptors.request.use((config) => {
|
||||
config.url += '?format=json'
|
||||
// config.url += '?format=json'
|
||||
return config
|
||||
})
|
||||
|
||||
|
|
|
@ -5,19 +5,17 @@ import { Form } from '../../elements/Form'
|
|||
import { Button } from '../../elements/Button'
|
||||
import { useForm } from 'antd/lib/form/Form'
|
||||
import { useAppContext } from '../../contexts/AppContext'
|
||||
import { useStacks } from '../../hooks/getMany/useStacks'
|
||||
|
||||
type FormValues = { email: string; password: string }
|
||||
type FormValues = { username: string; password: string }
|
||||
|
||||
export const Login = () => {
|
||||
const appContext = useAppContext()
|
||||
const stacks = useStacks('')
|
||||
|
||||
const [form] = useForm<FormValues>()
|
||||
|
||||
const handleFinish = async ({ email, password }: FormValues) => {
|
||||
const handleFinish = async ({ username, password }: FormValues) => {
|
||||
const res = await appContext.post('/dj-rest-auth/login', {
|
||||
email,
|
||||
username,
|
||||
password,
|
||||
})
|
||||
console.log(res)
|
||||
|
@ -27,7 +25,7 @@ export const Login = () => {
|
|||
<div className="login">
|
||||
<Form onFinish={handleFinish} form={form}>
|
||||
<h1>Log In</h1>
|
||||
<FormItem label="email" name="email">
|
||||
<FormItem label="username" name="username">
|
||||
<Input />
|
||||
</FormItem>
|
||||
<FormItem label="Password" name="password">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.contrib.auth.models import User, Group
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import permissions
|
||||
from rest_framework import viewsets, permissions
|
||||
from server.api import serializers, models
|
||||
|
||||
|
||||
class UserViewSet(viewsets.ModelViewSet):
|
||||
queryset = User.objects.all()
|
||||
serializer_class = serializers.UserSerializer
|
||||
|
@ -11,6 +11,7 @@ class UserViewSet(viewsets.ModelViewSet):
|
|||
def get_queryset(self):
|
||||
return [self.request.user]
|
||||
|
||||
|
||||
class AccountViewSet(viewsets.ModelViewSet):
|
||||
queryset = models.Account.objects.all()
|
||||
serializer_class = serializers.AccountSerializer
|
||||
|
@ -19,6 +20,7 @@ class AccountViewSet(viewsets.ModelViewSet):
|
|||
def get_queryset(self):
|
||||
return self.queryset.filter(users=self.request.user)
|
||||
|
||||
|
||||
class StackViewSet(viewsets.ModelViewSet):
|
||||
queryset = models.Stack.objects.all()
|
||||
serializer_class = serializers.StackSerializer
|
||||
|
@ -27,6 +29,7 @@ class StackViewSet(viewsets.ModelViewSet):
|
|||
def get_queryset(self):
|
||||
return self.queryset.filter(account__users=self.request.user)
|
||||
|
||||
|
||||
class TransactionViewSet(viewsets.ModelViewSet):
|
||||
queryset = models.Transaction.objects.all()
|
||||
serializer_class = serializers.TransactionSerializer
|
||||
|
|
|
@ -88,7 +88,7 @@ TEMPLATES = [
|
|||
]
|
||||
|
||||
WSGI_APPLICATION = 'server.wsgi.application'
|
||||
|
||||
APPEND_SLASH = False
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
||||
|
|
Loading…
Reference in New Issue
Block a user