Git Product home page Git Product logo

abp-vnext-react's Introduction

English | 简体中文

Abp Vnext React Template

An out-of-box UI solution for abp vnext as a React boilerplate.

Features

  • 📦 Out of the Box, Based on Umi and Antd Pro,Just configure the back-end service address to get started。It also provides a set of integrated plug-ins for ABP,Realize the seamless docking with ABP。

Getting Started

# install the cli
npm i @potatoabp/cli -g

then

# execute in an empty folder
potato

choose application

? Select the boilerplate type (Use arrow keys)
> application     - Create project with a abp vnext react front-end template

template will be installed automatically

Development

Install Dependencies

$ npm install

first update the service address in src/app.ts

// ... others
export const config: AbpConfig = {
  request: {
    apis: {
      default: {
        url: 'https://localhost:44355',
        rootNamespace: 'BookStore',
      },
    },
  },
  oauthConfig: {
    scope: '',
    clientId: '',
  },
};

second update the oauthconfig in src/services/login.ts(this is temporary)

// ... others
export async function fakeAccountLogin(params: LoginParamsType) {
  const urlencoded = new URLSearchParams();
  urlencoded.append('password', params.password);
  urlencoded.append('username', params.username);
  urlencoded.append('grant_type', 'password');
  urlencoded.append('client_id', 'BookStore_App');
  urlencoded.append('client_secret', '1q2w3e*');
  urlencoded.append('scope', 'BookStore');
  return request('/connect/token', {
    method: 'POST',
    data: urlencoded,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
  });
}

then

$ npm start

This will automatically open http://localhost:8000.

Hooks

localization

  • useLocalization
import { useLocalization } from 'umi';
const locale = useLocalization();
locale('AbpIdentity::Permissions');
  • useResource

permission

import { usePermission } from 'umi';
const isGranted = usePermission();
isGranted('abp.user.create');
  • usePermission

settings(TODO)

Routes

Built-in Account and Application layout pages See this config/routes.ts file to learn more

export default [
  {
    name: 'account',
    // set layout account or application
    layout: 'account',
    path: '/account/login',
    component: './User/login',
  },
];

Request

config

in the app.ts

export const config: AbpConfig = {
  request: {
    apis: {
      default: {
        url: 'https://localhost:44355',
        rootNamespace: 'BookStore',
      },
    },
    TenantManagement: {
      url: 'https://localhost:44370',
      rootNamespace: 'TenantManagement',
    },
  },
};

How to Use

import { request } from 'umi';

export async function outLogin() {
  return request('/api/login/outLogin', { apiName: 'TenantManagement' });
}

TODO

  • module management and addition
  • generate proxy
  • others...

abp-vnext-react's People

Contributors

realmingliang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.