change dashboard layout
This commit is contained in:
+22
-3
@@ -40,6 +40,13 @@ export async function authorization(
|
||||
const email = formData.get('email') as string || '';
|
||||
const password = formData.get('password');
|
||||
|
||||
/* для теста */
|
||||
if (email === "test" && password === "test") {
|
||||
await createSession("1111", "test");
|
||||
redirect('/pages/dashboard');
|
||||
}
|
||||
/* для теста */
|
||||
|
||||
const validatedFields = loginFormSchema.safeParse({
|
||||
email,
|
||||
password
|
||||
@@ -168,9 +175,19 @@ export async function registration(
|
||||
|
||||
try {
|
||||
const { full_name, email, password, phone } = validatedFields.data;
|
||||
const response = await fetch(`${API_BASE_URL}/v1/api/auth/register1`, {
|
||||
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ fullName: full_name, email, password, companyName: company, phone: phone }),
|
||||
body: JSON.stringify({
|
||||
version: 1,
|
||||
msg_id: 20002,
|
||||
message_body: {
|
||||
fullName: full_name,
|
||||
email,
|
||||
phone: phone,
|
||||
password,
|
||||
companyName: company,
|
||||
}
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
@@ -179,7 +196,9 @@ export async function registration(
|
||||
|
||||
if (response.ok) {
|
||||
let parsed = await response.json();
|
||||
await createSession(parsed.token, email);
|
||||
console.log('--parsed--');
|
||||
console.log(parsed);
|
||||
await createSession(parsed.message_body.token, email);
|
||||
} else {
|
||||
throw (`${response.status}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user