Site
- Add notif when account not valid - Add notif when account is create
This commit is contained in:
@ -0,0 +1,20 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* typeCreateAccount.js :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/09/10 14:25:42 by edbernar #+# #+# */
|
||||||
|
/* Updated: 2024/09/10 14:52:33 by edbernar ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
import { createNotification as CN } from "/static/javascript/notification/main.js";
|
||||||
|
|
||||||
|
function typeCreateAccount()
|
||||||
|
{
|
||||||
|
CN.new("Account created", "Please check your emails (including spam) to verify your account.");
|
||||||
|
}
|
||||||
|
|
||||||
|
export { typeCreateAccount }
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/31 22:17:24 by edbernar #+# #+# */
|
/* Created: 2024/07/31 22:17:24 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/09/09 14:47:26 by edbernar ### ########.fr */
|
/* Updated: 2024/09/10 14:49:32 by edbernar ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,14 +16,15 @@ import { typeErrorInvalidToken42 } from "/static/javascript/typeErrorResponse/ty
|
|||||||
import { typePrivateListMessage } from "/static/javascript/typeResponse/typePrivateListMessage.js";
|
import { typePrivateListMessage } from "/static/javascript/typeResponse/typePrivateListMessage.js";
|
||||||
import { typeNewPrivateMessage } from "/static/javascript/typeResponse/typeNewPrivateMessage.js";
|
import { typeNewPrivateMessage } from "/static/javascript/typeResponse/typeNewPrivateMessage.js";
|
||||||
import { typePrivateListUser } from "/static/javascript/typeResponse/typePrivateListUser.js";
|
import { typePrivateListUser } from "/static/javascript/typeResponse/typePrivateListUser.js";
|
||||||
|
import { typeCreateAccount } from "/static/javascript/typeResponse/typeCreateAccount.js";
|
||||||
import { typeAllListUser }from "/static/javascript/typeResponse/typeAllListUser.js";
|
import { typeAllListUser }from "/static/javascript/typeResponse/typeAllListUser.js";
|
||||||
import { createNotification as CN } from "/static/javascript/notification/main.js";
|
import { createNotification as CN } from "/static/javascript/notification/main.js";
|
||||||
import { typeLogin } from "/static/javascript/typeResponse/typeLogin.js";
|
import { typeLogin } from "/static/javascript/typeResponse/typeLogin.js";
|
||||||
|
|
||||||
const socket = new WebSocket('/ws');
|
const socket = new WebSocket('/ws');
|
||||||
|
|
||||||
const typeResponse = ["logged_in", "login", "private_list_user", "private_list_message", "new_private_message", "all_list_user"];
|
const typeResponse = ["logged_in", "login", "private_list_user", "private_list_message", "new_private_message", "all_list_user", "create_account"];
|
||||||
const functionResponse = [typeLogin, typeLogin, typePrivateListUser, typePrivateListMessage, typeNewPrivateMessage, typeAllListUser];
|
const functionResponse = [typeLogin, typeLogin, typePrivateListUser, typePrivateListMessage, typeNewPrivateMessage, typeAllListUser, typeCreateAccount];
|
||||||
|
|
||||||
const errorCode = [9007, 9010, 9011];
|
const errorCode = [9007, 9010, 9011];
|
||||||
const errorFunction = [typeErrorInvalidPassword, typeErrorInvalidToken42, typeErrorUnknown42Account];
|
const errorFunction = [typeErrorInvalidPassword, typeErrorInvalidToken42, typeErrorUnknown42Account];
|
||||||
@ -45,7 +46,7 @@ socket.onmessage = (event) => {
|
|||||||
}
|
}
|
||||||
if (response.code >= 9000 && response.code <= 9999)
|
if (response.code >= 9000 && response.code <= 9999)
|
||||||
{
|
{
|
||||||
if (response.code >= 9014 && response.code <= 9024)
|
if (response.code >= 9014 && response.code <= 9025)
|
||||||
{
|
{
|
||||||
console.log(response);
|
console.log(response);
|
||||||
CN.new("Error", response.content);
|
CN.new("Error", response.content);
|
||||||
@ -54,7 +55,9 @@ socket.onmessage = (event) => {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
errorFunction[errorCode.indexOf(response.code)]();
|
errorFunction[errorCode.indexOf(response.code)]();
|
||||||
} catch {
|
} catch ( error )
|
||||||
|
{
|
||||||
|
console.error(error);
|
||||||
console.warn(response);
|
console.warn(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user