mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-13 11:05:48 +00:00
refactor: remove unused user verification function and clean up user type definitions 🔨
This commit is contained in:
@ -363,18 +363,4 @@ export async function verifyTopupPayment(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProfile() {
|
|
||||||
const session = await getServerSession(authOptions);
|
|
||||||
const response = await fetch(
|
|
||||||
`${process.env.SARLINK_API_BASE_URL}/api/auth/profile/`,
|
|
||||||
{
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
Authorization: `Token ${session?.apiToken}`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return handleApiResponse<User>(response, "getProfile");
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
"use server";
|
"use server";
|
||||||
import type { TNationalPerson } from "@/lib/types";
|
import type { TNationalPerson } from "@/lib/types";
|
||||||
import type { User } from "./types/user";
|
|
||||||
|
|
||||||
export async function getNationalPerson({
|
export async function getNationalPerson({
|
||||||
idCard,
|
idCard,
|
||||||
@ -17,28 +16,4 @@ export async function getNationalPerson({
|
|||||||
return nationalData;
|
return nationalData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function VerifyUserDetails({ user }: { user: User }) {
|
|
||||||
console.log(user);
|
|
||||||
// const phoneNumber = String(user.phoneNumber).slice(4);
|
|
||||||
// console.log({ phoneNumber });
|
|
||||||
// const nationalData = await getNationalPerson({ idCard: user.id_card ?? "" });
|
|
||||||
// const dob = new Date(nationalData.dob);
|
|
||||||
// const age = new Date().getFullYear() - dob.getFullYear();
|
|
||||||
|
|
||||||
// console.log("ID card", user.id_card === nationalData.nic);
|
|
||||||
// console.log("name", user.name === nationalData.name_en);
|
|
||||||
// console.log("house", user.address === nationalData.house_name_en);
|
|
||||||
// console.log("phone", phoneNumber === nationalData.primary_contact);
|
|
||||||
// console.log("db phone", phoneNumber);
|
|
||||||
// console.log("national phone", nationalData.primary_contact);
|
|
||||||
|
|
||||||
// if (
|
|
||||||
// user.id_card === nationalData.nic &&
|
|
||||||
// user.name === nationalData.name_en &&
|
|
||||||
// user.address === nationalData.house_name_en &&
|
|
||||||
// age >= 18
|
|
||||||
// ) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { ISODateString } from "next-auth";
|
import type { ISODateString } from "next-auth";
|
||||||
|
import type { Atoll, Island } from "../backend-types";
|
||||||
|
|
||||||
export interface Permission {
|
export interface Permission {
|
||||||
id: number;
|
id: number;
|
||||||
@ -30,6 +31,22 @@ export interface User {
|
|||||||
last_login: string;
|
last_login: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UserProfile {
|
||||||
|
id: number;
|
||||||
|
email: string;
|
||||||
|
first_name: string;
|
||||||
|
last_name: string;
|
||||||
|
atoll: Atoll;
|
||||||
|
island: Island;
|
||||||
|
dob: string;
|
||||||
|
verified: boolean;
|
||||||
|
username: string;
|
||||||
|
mobile: string;
|
||||||
|
address: string;
|
||||||
|
acc_no: string;
|
||||||
|
id_card: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Session {
|
export interface Session {
|
||||||
user?: {
|
user?: {
|
||||||
token?: string;
|
token?: string;
|
||||||
|
Reference in New Issue
Block a user