mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-04-20 03:50:20 +00:00
add non stretched favicon
This commit is contained in:
parent
7fadcd561f
commit
e9c71c1e58
@ -13,10 +13,7 @@ const formSchema = z.object({
|
||||
.regex(/^[7|9][0-9]{2}-[0-9]{4}$/, "Please enter a valid phone number"),
|
||||
});
|
||||
|
||||
export async function signin(
|
||||
previousState: ActionState,
|
||||
formData: FormData,
|
||||
) {
|
||||
export async function signin(previousState: ActionState, formData: FormData) {
|
||||
const phoneNumber = formData.get("phoneNumber") as string;
|
||||
const result = formSchema.safeParse({ phoneNumber });
|
||||
console.log(phoneNumber);
|
||||
@ -55,19 +52,16 @@ type ActionState = {
|
||||
payload?: FormData;
|
||||
};
|
||||
|
||||
export async function signup(
|
||||
_actionState: ActionState,
|
||||
formData: FormData,
|
||||
) {
|
||||
export async function signup(_actionState: ActionState, formData: FormData) {
|
||||
const data = Object.fromEntries(formData.entries());
|
||||
const parsedData = signUpFormSchema.safeParse(data);
|
||||
// get phone number from /signup?phone_number=999-1231
|
||||
const headersList = await headers()
|
||||
const referer = headersList.get("referer")
|
||||
const number = referer?.split("?")[1]?.split("=")[1]
|
||||
let NUMBER_WITH_COUNTRY_CODE: string
|
||||
const headersList = await headers();
|
||||
const referer = headersList.get("referer");
|
||||
const number = referer?.split("?")[1]?.split("=")[1];
|
||||
let NUMBER_WITH_COUNTRY_CODE: string;
|
||||
|
||||
console.log(data)
|
||||
console.log(data);
|
||||
|
||||
if (!parsedData.success) {
|
||||
return {
|
||||
@ -76,25 +70,19 @@ export async function signup(
|
||||
errors: parsedData.error.flatten(),
|
||||
};
|
||||
}
|
||||
if (parsedData.data.name.includes("a")){
|
||||
return {
|
||||
message: "ID card already exists.",
|
||||
payload: formData,
|
||||
db_error: "id_card",
|
||||
};
|
||||
}
|
||||
|
||||
if (number) {
|
||||
NUMBER_WITH_COUNTRY_CODE = `+960${number.split("-").join("")}`
|
||||
NUMBER_WITH_COUNTRY_CODE = `+960${number.split("-").join("")}`;
|
||||
} else {
|
||||
NUMBER_WITH_COUNTRY_CODE = `+960${parsedData.data.phone_number.split("-").join("")}`;
|
||||
}
|
||||
console.log({NUMBER_WITH_COUNTRY_CODE})
|
||||
console.log({ NUMBER_WITH_COUNTRY_CODE });
|
||||
const idCardExists = await prisma.user.findFirst({
|
||||
where: {
|
||||
id_card: parsedData.data.id_card,
|
||||
},
|
||||
});
|
||||
|
||||
if (idCardExists) {
|
||||
return {
|
||||
message: "ID card already exists.",
|
||||
@ -102,21 +90,38 @@ export async function signup(
|
||||
db_error: "id_card",
|
||||
};
|
||||
}
|
||||
// const newUser = await prisma.user.create({
|
||||
// data: {
|
||||
// name: parsedData.data.name,
|
||||
// islandId: "1",
|
||||
// atollId: "1",
|
||||
// house_name: parsedData.data.house_name,
|
||||
// id_card: parsedData.data.id_card,
|
||||
// dob: parsedData.data.dob,
|
||||
// phoneNumber: NUMBER_WITH_COUNTRY_CODE,
|
||||
// },
|
||||
// });
|
||||
// await authClient.phoneNumber.sendOtp({
|
||||
// phoneNumber: newUser.phoneNumber,
|
||||
// });
|
||||
// redirect(`/verify-otp?phone_number=${encodeURIComponent(newUser.phoneNumber)}`);
|
||||
|
||||
const phoneNumberExists = await prisma.user.findFirst({
|
||||
where: {
|
||||
phoneNumber: NUMBER_WITH_COUNTRY_CODE,
|
||||
},
|
||||
});
|
||||
|
||||
if (phoneNumberExists) {
|
||||
return {
|
||||
message: "Phone number already exists.",
|
||||
payload: formData,
|
||||
db_error: "phone_number",
|
||||
};
|
||||
}
|
||||
|
||||
const newUser = await prisma.user.create({
|
||||
data: {
|
||||
name: parsedData.data.name,
|
||||
islandId: parsedData.data.island_id,
|
||||
atollId: parsedData.data.atoll_id,
|
||||
house_name: parsedData.data.house_name,
|
||||
id_card: parsedData.data.id_card,
|
||||
dob: parsedData.data.dob,
|
||||
phoneNumber: NUMBER_WITH_COUNTRY_CODE,
|
||||
},
|
||||
});
|
||||
await authClient.phoneNumber.sendOtp({
|
||||
phoneNumber: newUser.phoneNumber,
|
||||
});
|
||||
// redirect(
|
||||
// `/verify-otp?phone_number=${encodeURIComponent(newUser.phoneNumber)}`,
|
||||
// );
|
||||
|
||||
return { message: "Post created" };
|
||||
}
|
||||
|
BIN
app/favicon.ico
BIN
app/favicon.ico
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
25
package-lock.json
generated
25
package-lock.json
generated
@ -20,6 +20,7 @@
|
||||
"@radix-ui/react-separator": "^1.1.0",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@radix-ui/react-tooltip": "^1.1.4",
|
||||
"@tanstack/react-query": "^5.61.4",
|
||||
"better-auth": "^1.0.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
@ -2369,6 +2370,30 @@
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/query-core": {
|
||||
"version": "5.61.4",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.61.4.tgz",
|
||||
"integrity": "sha512-rsnemyhPvEG4ViZe0R2UQDM8NgQS/BNC5/Gf9RTs0TKN5thUhPUwnL2anWG4jxAGKFyDfvG7PXbx6MRq3hxi1w==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@tanstack/react-query": {
|
||||
"version": "5.61.4",
|
||||
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.61.4.tgz",
|
||||
"integrity": "sha512-Nh5+0V4fRVShSeDHFTVvzJrvwTdafIvqxyZUrad71kJWL7J+J5Wrd/xcHTWfSL1mR/9eoufd2roXOpL3F16ECA==",
|
||||
"dependencies": {
|
||||
"@tanstack/query-core": "5.61.4"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18 || ^19"
|
||||
}
|
||||
},
|
||||
"node_modules/@tybys/wasm-util": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.8.3.tgz",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"@radix-ui/react-separator": "^1.1.0",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@radix-ui/react-tooltip": "^1.1.4",
|
||||
"@tanstack/react-query": "^5.61.4",
|
||||
"better-auth": "^1.0.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user