import { Token } from "@prisma/client"
import { Logging } from "../logging"

export default async function loginCheck<T>(
  payload: T & { loginCheck: boolean; tokenDB: Token; tokenType: "REFRESH" }
) {
  const { loginCheck, tokenDB } = payload
  // True login check response
  if (loginCheck) {
    return Promise.resolve({
      message: "loginCheck " + loginCheck + " of " + tokenDB.id,
      body: { loggedIn: true },
      type: ["debug", "info.cyan"] as Logging[],
    })
  }
  return payload
}
