finishing auth controller verification

This commit is contained in:
rafiarrafif
2025-05-13 14:35:48 +07:00
parent ad9f66a642
commit 9cb84372b8
7 changed files with 78 additions and 28 deletions

View File

@ -0,0 +1,12 @@
import { AppError } from "../../../helpers/error/instances/app";
import { jwtDecode } from "../../../helpers/http/jwt/decode";
import { jwtEncode } from "../../../helpers/http/jwt/encode";
export const authVerificationService = (cookie: string) => {
try {
const userToken = jwtDecode(cookie);
return userToken;
} catch (error) {
throw new AppError(401, "Token is invalid");
}
};