mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-11 01:53:51 +00:00
Fixed loading state in servers list
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { listShortUrls } from './reducers/shortUrlsList';
|
import { listShortUrls } from './reducers/shortUrlsList';
|
||||||
|
import { isEmpty } from 'ramda';
|
||||||
|
|
||||||
export class ShortUrlsList extends React.Component {
|
export class ShortUrlsList extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -18,8 +19,8 @@ export class ShortUrlsList extends React.Component {
|
|||||||
|
|
||||||
renderShortUrls() {
|
renderShortUrls() {
|
||||||
const { shortUrlsList } = this.props;
|
const { shortUrlsList } = this.props;
|
||||||
if (! shortUrlsList) {
|
if (isEmpty(shortUrlsList)) {
|
||||||
return '<li><i>Loading...</i></li>';
|
return <li><i>Loading...</i></li>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return shortUrlsList.map(shortUrl => (
|
return shortUrlsList.map(shortUrl => (
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export const listShortUrls = (serverId) => {
|
|||||||
const selectedServer = ServersService.findServerById(serverId);
|
const selectedServer = ServersService.findServerById(serverId);
|
||||||
|
|
||||||
ShlinkApiClient.setConfig(selectedServer);
|
ShlinkApiClient.setConfig(selectedServer);
|
||||||
dispatch({ type: LIST_SHORT_URLS, shortUrls: await ShlinkApiClient.listShortUrls() });
|
const shortUrls = await ShlinkApiClient.listShortUrls();
|
||||||
|
dispatch({ type: LIST_SHORT_URLS, shortUrls });
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user