Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/ecommerce-delivery-frontend/llms.txt

Use this file to discover all available pages before exploring further.

Ecommerce Delivery provides three sequential auth screens for new and returning users: a sign-in form at /login, a registration form at /registro, and a security-code verification step at /security-code. All three are standalone pages (no main layout wrapper) that store a JWT and user object in localStorage upon success and redirect the user into the application.

Sign In

The sign-in screen lives at route /login and is rendered by pages/login/SignIn.vue, which hosts the formSignIn.vue component.
  • Route: /login · route name login
  • Component: pages/login/SignIncomponents/login/formSignIn.vue
  • Required fields: email (non-empty), password (min. 8 characters)
On submission, formSignIn posts credentials to POST /api/user/login. A successful response saves the session to localStorage, registers the device’s FCM token for push notifications, and redirects to /posts (the main store).
const signIn = () => {
  const data = {
    email: email.value?.toLowerCase(),
    password: password.value,
  };

  fetch(process.env.API_SERVER + "/api/user/login", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(data),
  })
    .then(async (res) => {
      const response = await res.json();
      if (!res.ok) throw new Error(response.msj || "Error en la respuesta del servidor");

      localStorage.setItem("user", JSON.stringify(response.user));
      localStorage.setItem("token", response.token);

      // Register FCM token for push notifications
      const permission = await Notification.requestPermission();
      if (permission === "granted") {
        const tokenFCM = await getToken(messaging, { vapidKey: "..." });
        if (tokenFCM) {
          await fetch(process.env.API_SERVER + "/api/notification/register-token", {
            method: "POST",
            headers: {
              Authorization: `Bearer ${response.token}`,
              "Content-Type": "application/json",
            },
            body: JSON.stringify({ userId: response.user.id, fcmToken: tokenFCM }),
          });
        }
      }

      router.push({ name: "posts" });
    });
};
After a successful login the app calls POST /api/notification/register-token with the user’s Firebase Cloud Messaging token to enable push notifications for order updates and promotions.

Sign Up

New users register at route /registro, rendered by pages/login/signUp.vuecomponents/login/formSignUp.vue.
  • Route: /registro · route name registro
  • Component: pages/login/signUpcomponents/login/formSignUp.vue
  • Required fields: name, email, password (min. 8 characters), accept: true
  • Optional field: meseller — a referral / promotor code
The accept flag (Terms and Conditions toggle) must be true; if it is false the form fires a Quasar notify warning and aborts the request before any network call is made. On success, the token and user object are saved to localStorage and the user is redirected to /security-code for email verification.
const crearUsuario = () => {
  if (!accept.value) {
    $q.notify({ color: "red-5", message: "Acepta los terminos y condiciones" });
    return;
  }

  const data = {
    name: name.value?.toLowerCase(),
    email: email.value,
    password: password.value,
    accept: accept.value,
    meseller: meseller.value?.toLowerCase(),
  };

  fetch(process.env.API_SERVER + "/api/user/create", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(data),
  })
    .then((response) => response.json())
    .then((response) => {
      localStorage.setItem("token", response.token);
      localStorage.setItem("user", JSON.stringify(response.user));
      return router.push({ name: "security-code" });
    });
};
The meseller field is optional. Leave it empty (or omit it) if the user is registering without a promotor referral code.

Security code verification

After registration, the user must confirm ownership of their email address before getting full access to the platform.
  • Route: /security-code · route name security-code
  • Component: pages/security/secureCodecomponents/Security/formSecurityCode.vue
The form asks for the user’s email and the 6-digit code sent to that address. On a correct match the backend responds with a fresh token and user object, which replace the values already in localStorage, and the app navigates to the main store (inicio).
const verifyAccount = () => {
  const data = {
    email: email.value,
    code: code.value,         // 6-digit confirmation code
  };

  fetch(process.env.API_SERVER + "/api/user/verify-account", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(data),
  })
    .then((response) => response.json())
    .then((response) => {
      localStorage.setItem("token", response.token);
      localStorage.setItem("user", JSON.stringify(response.user));
      return router.push({ name: "inicio" });
    });
};
If the code does not arrive, the user can tap Reenviar on the verification screen. The button calls POST /api/user/resend-code with the user’s email and displays the result inline via a Quasar notification. The button shows a loading spinner (resending ref) while the request is in flight.
If the account is already verified, the API returns alreadyVerified: true in the error response and the UI shows an orange informational notification instead of a red error. The user can proceed directly to /login in that case.

Build docs developers (and LLMs) love