79452118

Date: 2025-02-19 16:39:31
Score: 3.5
Natty:
Report link

This seemed to work for me: first you need to call sanctum but before calling sanctum add this line on your axios file axios.defaults.withCredentials = true; then call sanctum eg // axios .get( "http://localhost:9000/sanctum/csrf-cookie" ) .then((res) => toast.success("sanctum loaded successfully")); then now you can create a custom object export const axiosInstance = axios.create({ baseURL: "http://localhost:9000/api/", timeout: 100000, withXSRFToken: true, timeoutErrorMessage: "Server timeout", }); then use the instance to make other api calls eg register

Reasons:
  • Blacklisted phrase (1): thX
  • Contains signature (1):
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Tim