fix: login & csrf api routes

This commit is contained in:
karishmas6
2024-09-24 12:31:57 +05:30
parent 4ad5b46fd3
commit 6a50edff22

View File

@@ -68,7 +68,7 @@ const Provider = ({ children }: ProviderProps) => {
if (res.status === 401 && res.config && !res.config.__isRetryRequest) {
return new Promise((resolve, reject) => {
axios
.get('/api/logout')
.get('http://localhost:8080/auth/logout')
.then((data) => {
console.log('/401 error > logout');
dispatch({ type: 'LOGOUT' });
@@ -88,7 +88,7 @@ const Provider = ({ children }: ProviderProps) => {
// csrf - include tokens in the axios header every time a request is made
useEffect(() => {
const getCsrfToken = async () => {
const { data } = await axios.get('/api/csrf-token');
const { data } = await axios.get('http://localhost:8080/csrf-token');
console.log('CSRFFFFF =>>>>', data);
(axios.defaults.headers as any)['X-CSRF-TOKEN'] = data.getCsrfToken;
};