Files
sistema_base/apps/web/feactures/auth/actions/refresh-token-action.ts

22 lines
536 B
TypeScript

'use server';
import { safeFetchApi } from '@/lib';
import {
RefreshTokenResponseSchema,
RefreshTokenValue,
} from '../schemas/refreshToken';
export const resfreshTokenAction = async (refreshToken: RefreshTokenValue) => {
// return null // Descomentar esto evita que se tenga que borrar cache al navegador
const [error, data] = await safeFetchApi(
RefreshTokenResponseSchema,
'/auth/refreshToken',
'POST',
refreshToken,
);
if (error) {
console.error('Error:', error);
} else {
return data;
}
};