Angular project and cuba-platform

hi everyone… i hpe you are fine
sorry for my very pour english
im new in the platfom and i m a student
i wan to know how can i make runing angular (4) project on cuba platform
I’ve seen the tutorial about but I didnt understand it … it’s the tutorial about “single-page web application with REST API Backend”…
if some one can try to esplain it to me again STEP BY STEP … i wll be very happy
thanks for your help

Hi,

Could you explain in more details? What parts of the tutorial were unclear? Are your questions related to CUBA.platform or Angular?

Regards,
Gleb

hi,
i speak about the Big Cubina Burger
its an angular project running on cuba platform with CUBA REST API ,… backend application…
and i will like to know how to download images on cuba project from an entity like menuItems (price, quantity, IMAGE, …)
How to make run this angular project on cuba platform
thanks for your help

i will like to know how to download images on cuba project from an entity like menuItems

First of all, take a look at applications written in the mentioned tutorial:

According to swagger documentation, a file represented by the FileDescriptor entity can be obtained at
the {app_base_url}/rest/v2/files/{id} path.

You can see the example of accessing this path within the MenuItemsService#getImageUrl method.

How to make run this angular project on cuba platform

Actually, you have answered your own question:

… an angular project running on cuba platform with CUBA REST API…

The only thing I would like to pay attention to is that CUBA REST JS library is used to facilitate CUBA Platfotm’s REST API usage in the given Angular project.

Regards,
Gleb

lot of thanks Gleb for your help.
i done it … everything its right now. very thanks
But i have more request about the front-end
for angular project just look this file :

loginComponent.ts

import { Component } from '@angular/core';
import { Location } from '@angular/common';
import { AuthenticationService } from '../_services/authentication.service';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: [ './login.component.css' ]
})

export class LoginComponent {
  private credentials: any = { username: 'demo', password: 'demo' };

  constructor(private location: Location,
              private authenticationService: AuthenticationService) {
  }


  login() {
    this.authenticationService.login(this.credentials.username, this.credentials.password)
      .then(() => {
        this.location.back();
      });
  }
  
}

here you have just set up like user to access the site the administrator in this case “demo”

how do I do to define two types of users: user and administrator
so that only the user can make an order while the administrator can update the products in make an order in the front-end.
and also have the list of users logged in to the site registered in the backside in cuba platform ?
i try but i didnt have solution
thanks for help.

Hi,

I would suggest creating a service that will return with required information. For instance, you can return user’s roles (the sec$Role entity) and update your front-end UI according to a role. The information about logged in users stored in sec$UserSessionEntity.

Regards,
Gleb

okay Gleb
thanks.
nfs