Skip to content

Commit 51d856e

Browse files
committed
Log error if token content is null
1 parent c774fcc commit 51d856e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

site/src/api/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as TypesGen from "./typesGenerated"
66

77
// Always attach CSRF token to all requests
88
const token = document.head.querySelector('meta[property="csrf-token"]')
9-
if (token) {
9+
if (token !== null && token.getAttribute("content") !== null) {
1010
axios.defaults.headers.common["X-CSRF-TOKEN"] = token.getAttribute("content") ?? ""
1111
} else {
1212
console.error("CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token")

0 commit comments

Comments
 (0)