14 lines
555 B
TypeScript
14 lines
555 B
TypeScript
/**
|
|
*
|
|
* @description this file contain the @validateAuthToken function that be used inside the middleware.ts
|
|
* * source : https://mongoosejs.com/docs/6.x/docs/typescript.html
|
|
*/
|
|
|
|
export default async function validateAuthToken(authToken : string | undefined) : Promise<boolean | undefined>
|
|
{
|
|
console.log("----------NEXT_PUBLIC_API_BASE : " , process.env.NEXT_PUBLIC_API_BASE)
|
|
let data : {
|
|
success : boolean,
|
|
} = await (await fetch(process.env.NEXT_PUBLIC_API_BASE+"/api/auth?authToken="+authToken)).json()
|
|
return data.success
|
|
} |