csrf remove

This commit is contained in:
Kseninia Mikhaylova 2024-07-23 09:42:13 +03:00
parent db671877b1
commit 9593ee02fa
9 changed files with 25 additions and 7 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
.vscode/
.venv/
.env
env/*.env

View File

@ -37,11 +37,13 @@ ALLOWED_HOSTS = [
"toinv.svs-tech.pro",
]
CORS_ALLOWED_ORIGINS = [
"http://localhost",
"http://localhost:3000",
"http://192.168.103.159:3000",
"https://toinv.svs-tech.pro",
]
CSRF_TRUSTED_ORIGINS = [
"http://localhost",
"https://toinv.svs-tech.pro",
]
# Application definition

View File

@ -24,6 +24,8 @@ class TgItemViewSet(viewsets.ModelViewSet):
queryset = TgItem.objects.all().order_by("-updated_at")
serializer_class = TgItemSerializer
http_method_names = ["post", "get", "patch"]
permission_classes = ()
authentication_classes = ()
def retrieve(self, request, pk=None):
item = TgItem.objects.get(id=pk)
@ -50,6 +52,8 @@ class TmcFieldViewset(viewsets.ModelViewSet):
queryset = TmcField.objects.all()
serializer_class = TmcFieldSerializer
http_method_names = ["post", "get", "patch"]
permission_classes = ()
authentication_classes = ()
def partial_update(self, request, *args, **kwargs):
return super().partial_update(request)

View File

@ -13,7 +13,7 @@ services:
timeout: 3s
retries: 20
volumes:
- ./.env:/app/.env
- ./back/.env:/app/.env
networks:
- toinv-network
image: ci.svs-tech.pro/toinv_back:latest

View File

@ -4,3 +4,6 @@ DB_PASSWORD=
DB_HOST=
DB_PORT=
ODATA_AUTH=
TG_TOKEN=
NGROK_TEMP=

1
env/docker.env.example vendored Normal file
View File

@ -0,0 +1 @@
WEB_PORT=80

1
env/front.env.example vendored Normal file
View File

@ -0,0 +1 @@
NUXT_PUBLIC_API_BASE='http://localhost:8000/api'

View File

@ -43,10 +43,10 @@ onMounted(async () => {
loadTer()
})
const patchField = async (field) => {
await apiCall(`tgbot/items/${field.id}/`, 'PATCH', { text: field.text })
await apiCall(`tgbot/items/${field.id}/`, 'patch', { text: field.text })
}
const patchItem = async () => {
await apiCall(`tgbot/${state.id}/`, 'PATCH', { name: state.name, location: state.location })
await apiCall(`tgbot/${state.id}/`, 'patch', { name: state.name, location: state.location })
}
</script>
<template>

View File

@ -3,3 +3,9 @@
## DEV
* Как запустить: `./dev.sh`
## Примонтировать энв-файлы
* `ln -s ~/projects/to_inventory/env/docker.env ~/projects/to_inventory/.env`
* `ln -s ~/projects/to_inventory/env/back.env ~/projects/to_inventory/back/.env`
* `ln -s ~/projects/to_inventory/env/front.env ~/projects/to_inventory/front/.env`