Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: projectName is not defined in ServiceProxyScript #20158

Closed
alihdev opened this issue Jul 3, 2024 · 7 comments
Closed

ReferenceError: projectName is not defined in ServiceProxyScript #20158

alihdev opened this issue Jul 3, 2024 · 7 comments

Comments

@alihdev
Copy link
Contributor

alihdev commented Jul 3, 2024

Hi
In the ServiceProxyScript file, there is no reference to "projectName."

As a result, the following error occurs in the web console: "Uncaught ReferenceError: projectName is not defined."
image

Abp version 8.0.0

ServiceProxyScript:

/* This file is automatically generated by ABP framework to use MVC Controllers from javascript. */


// module account

(function(){

  // controller volo.abp.account.account

  (function(){

    abp.utils.createNamespace(window, 'volo.abp.account.account');

    volo.abp.account.account.register = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/register',
        type: 'POST',
        data: JSON.stringify(input)
      }, ajaxParams));
    };

    volo.abp.account.account.sendPasswordResetCode = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/send-password-reset-code',
        type: 'POST',
        dataType: null,
        data: JSON.stringify(input)
      }, ajaxParams));
    };

    volo.abp.account.account.verifyPasswordResetToken = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/verify-password-reset-token',
        type: 'POST',
        data: JSON.stringify(input)
      }, ajaxParams));
    };

    volo.abp.account.account.resetPassword = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/reset-password',
        type: 'POST',
        dataType: null,
        data: JSON.stringify(input)
      }, ajaxParams));
    };

  })();

  // controller volo.abp.account.dynamicClaims

  (function(){

    abp.utils.createNamespace(window, 'volo.abp.account.dynamicClaims');

    volo.abp.account.dynamicClaims.refresh = function(ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/dynamic-claims/refresh',
        type: 'POST',
        dataType: null
      }, ajaxParams));
    };

  })();

  // controller volo.abp.account.profile

  (function(){

    abp.utils.createNamespace(window, 'volo.abp.account.profile');

    volo.abp.account.profile.get = function(ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/my-profile',
        type: 'GET'
      }, ajaxParams));
    };

    volo.abp.account.profile.update = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/my-profile',
        type: 'PUT',
        data: JSON.stringify(input)
      }, ajaxParams));
    };

    volo.abp.account.profile.changePassword = function(input, ajaxParams) {
      return abp.ajax($.extend(true, {
        url: abp.appPath + 'api/account/my-profile/change-password',
        type: 'POST',
        dataType: null,
        data: JSON.stringify(input)
      }, ajaxParams));
    };

  })();

})();

abp.event.trigger('abp.serviceProxyScriptInitialized');

Feel free to let me know if you need any additional changes!

@alihdev
Copy link
Contributor Author

alihdev commented Jul 3, 2024

Project with issue: DotnetAbp.Issues.Web.ServiceProxyScript

@maliming
Copy link
Member

maliming commented Jul 3, 2024

hi

Steps needed to reproduce the problem.

@alihdev
Copy link
Contributor Author

alihdev commented Jul 3, 2024

Hi,

To reproduce the problem, please follow these steps:

You should see the error "Uncaught ReferenceError: exch is not defined" in the console.

Please let me know if you need any further information

@maliming
Copy link
Member

maliming commented Jul 5, 2024

hi

You are using the tiered project. You can add the TransferController in the Exch.HttpApi project.

alihdev added a commit to alihdev/DotnetAbp.Issues.Web.ServiceProxyScript that referenced this issue Jul 6, 2024
alihdev added a commit to alihdev/DotnetAbp.Issues.Web.ServiceProxyScript that referenced this issue Jul 6, 2024
alihdev added a commit to alihdev/DotnetAbp.Issues.Web.ServiceProxyScript that referenced this issue Jul 6, 2024
alihdev added a commit to alihdev/DotnetAbp.Issues.Web.ServiceProxyScript that referenced this issue Jul 6, 2024
@alihdev
Copy link
Contributor Author

alihdev commented Jul 6, 2024

Hi,

We added TransferController in the Exch.HttpApi project, but the issue persists.

Is there any way to make it dynamic like Auto API Controllers?

@maliming
Copy link
Member

maliming commented Jul 8, 2024

using Exch.App.Transfers;
using Exch.App.Transfers.Dtos;
using System.Threading.Tasks;
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace Exch.Controllers.App.Transfers;

[Controller]
[RemoteService(Name = "Exch")]
[Area("Exch")]
[ControllerName("Exch")]
[Route("/api/app/transfers")]
public class TransferController(ITransferAppService transferAppService) : ExchController
{
    private readonly ITransferAppService _transferAppService = transferAppService;

    public Task<TransferDto> CreateAsync(TransferCreateDto input)
    {
        return _transferAppService.CreateAsync(input);
    }

    public Task<TransferDto> UpdateAsync(int id, TransferUpdateDto input)
    {
        return _transferAppService.UpdateAsync(id, input);
    }

    public Task<TransferDto> GetAsync(int id)
    {
        return _transferAppService.GetAsync(id);
    }

    public Task<PagedResultDto<TransferDto>> GetListAsync(TransferGetListInput input)
    {
        return _transferAppService.GetListAsync(input);
    }

    public Task DeleteAsync(int id)
    {
        return _transferAppService.DeleteAsync(id);
    }
}

image

@alihdev alihdev closed this as completed Jul 8, 2024
alihdev added a commit to alihdev/DotnetAbp.Issues.Web.ServiceProxyScript that referenced this issue Jul 8, 2024
@alihdev
Copy link
Contributor Author

alihdev commented Jul 8, 2024

Thank u @maliming
Just a note: we moved the TransferController from Exch.HttpApi to Exch.Web because having it in Exch.HttpApi caused a duplicate route issue (Auto API Controllers).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants