File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 11clean-backend :
2- @rm -rf frontend /.cache
3- @rm -rf frontend /.local
4- @rm -rf frontend /.venv
2+ @rm -rf backend /.cache
3+ @rm -rf backend /.local
4+ @rm -rf backend /.venv
55
66exec-backend-command :
77 @docker exec -i nest-backend $(CMD )
Original file line number Diff line number Diff line change 22
33from django .http import JsonResponse
44from django .middleware .csrf import get_token
5+ from django .views .decorators .csrf import ensure_csrf_cookie
6+ from django .views .decorators .http import require_GET
57
68
9+ @require_GET
10+ @ensure_csrf_cookie
711def get_csrf_token (request ):
812 """Return a response with the CSRF token."""
913 return JsonResponse ({"csrftoken" : get_token (request )})
Original file line number Diff line number Diff line change @@ -68,10 +68,12 @@ export type IndexedObject = {
6868
6969export const getCsrfToken = async ( ) : Promise < string > => {
7070 const csrfToken = document . cookie
71- . split ( ';' )
72- . map ( ( cookie ) => cookie . split ( '=' ) )
73- . find ( ( [ key ] ) => key . trim ( ) === 'csrftoken' ) ?. [ 1 ]
74- ?. trim ( )
71+ ? document . cookie
72+ . split ( ';' )
73+ . map ( ( cookie ) => cookie . split ( '=' ) )
74+ . find ( ( [ key ] ) => key . trim ( ) === 'csrftoken' ) ?. [ 1 ]
75+ ?. trim ( )
76+ : undefined
7577
7678 if ( csrfToken ) {
7779 return csrfToken
You can’t perform that action at this time.
0 commit comments