Skip to content

Commit

Permalink
[add] bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ymuichiro committed Nov 9, 2023
1 parent daac920 commit 57951e7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
21 changes: 13 additions & 8 deletions src/pages/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const Community: NextPage<Props> = ({ i18n, communityReleases, spaces, locale })
const matches = useMediaQuery(theme.breakpoints.between('xs', 'md'));
const [currentPage, setCurrentPage] = useState<number>(1);
const [docs, setDocs] = useState<CommunityReleaseFindResponse['data']>(communityReleases);
const [lastPage, setLastPage] = useState<boolean>(false);

const handleAddDocuments = () => {
const _currentPage = currentPage + 1;
Expand All @@ -52,7 +53,9 @@ const Community: NextPage<Props> = ({ i18n, communityReleases, spaces, locale })
});
setCurrentPage(_currentPage);
setDocs([...docs, ...articles.data]);
console.log([...docs, ...articles.data]);
if (articles.meta.pagination.pageCount === articles.meta.pagination.page) {
setLastPage(true);
}
});
};

Expand Down Expand Up @@ -172,13 +175,15 @@ const Community: NextPage<Props> = ({ i18n, communityReleases, spaces, locale })
/>
</Grid>
))}
<Grid item xs={12}>
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
<Button onClick={handleAddDocuments} fullWidth variant='outlined' style={{ maxWidth: '600px' }}>
Next
</Button>
</div>
</Grid>
{!lastPage && (
<Grid item xs={12}>
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
<Button onClick={handleAddDocuments} fullWidth variant='outlined' style={{ maxWidth: '600px' }}>
Next
</Button>
</div>
</Grid>
)}
</Grid>
<Footer />
</Container>
Expand Down
22 changes: 14 additions & 8 deletions src/pages/news.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const News: NextPage<Props> = ({ i18n, newsReleases, locale }) => {
const matches = useMediaQuery(theme.breakpoints.between('xs', 'md'));
const [currentPage, setCurrentPage] = useState<number>(1);
const [docs, setDocs] = useState<NewsReleaseFindResponse['data']>(newsReleases);
const [lastPage, setLastPage] = useState<boolean>(false);

const handleAddDocuments = () => {
const _currentPage = currentPage + 1;
Expand All @@ -45,9 +46,12 @@ const News: NextPage<Props> = ({ i18n, newsReleases, locale }) => {
article.attributes.localizations.data = [];
return article;
});

setCurrentPage(_currentPage);
setDocs([...docs, ...articles.data]);
console.log([...docs, ...articles.data]);
if (articles.meta.pagination.pageCount === articles.meta.pagination.page) {
setLastPage(true);
}
});
};

Expand Down Expand Up @@ -99,13 +103,15 @@ const News: NextPage<Props> = ({ i18n, newsReleases, locale }) => {
/>
</Grid>
))}
<Grid item xs={12}>
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
<Button onClick={handleAddDocuments} fullWidth variant='outlined' style={{ maxWidth: '600px' }}>
Next
</Button>
</div>
</Grid>
{!lastPage && (
<Grid item xs={12}>
<div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}>
<Button onClick={handleAddDocuments} fullWidth variant='outlined' style={{ maxWidth: '600px' }}>
Next
</Button>
</div>
</Grid>
)}
</Grid>
<Footer />
</Container>
Expand Down
1 change: 0 additions & 1 deletion src/services/StrapiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const initFindOneRequest = (baseUrl: string, options?: StrapiFindOptions): strin

export async function findNewsRelease(locale?: string, options?: StrapiFindOptions): Promise<NewsReleaseFindResponse> {
const ep = initFindRequest([process.env.NEXT_PUBLIC_API_URL, 'api', 'news-releases'].join('/'), locale, options);
console.log(ep);
const response = await fetch(ep, { method: 'GET' });
if (response.status >= 400) throw new Error(`${findNewsRelease.name}: An error has occurred on the server.`);
return await response.json();
Expand Down
12 changes: 5 additions & 7 deletions src/services/symbolService.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { firstValueFrom } from 'rxjs';
import { requestSign, setTransaction, getActivePublicKey } from 'sss-module';
import { getActivePublicKey, requestSign, setTransaction } from 'sss-module';
import { QRCodeGenerator, TransactionQR } from 'symbol-qr-library';
import { Convert } from 'symbol-sdk/dist/src/core/format';
import { TransactionMapping } from 'symbol-sdk/dist/src/core/utils';
import { RepositoryFactoryHttp } from 'symbol-sdk/dist/src/infrastructure/RepositoryFactoryHttp';
import { UInt64 } from 'symbol-sdk/dist/src/model/UInt64';
import { Address } from 'symbol-sdk/dist/src/model/account';
import { PlainMessage } from 'symbol-sdk/dist/src/model/message/PlainMessage';
import { Mosaic, MosaicId } from 'symbol-sdk/dist/src/model/mosaic';
import { NetworkType } from 'symbol-sdk/dist/src/model/network';
import { Deadline, SignedTransaction, TransferTransaction, Transaction } from 'symbol-sdk/dist/src/model/transaction';
import { TransactionMapping } from 'symbol-sdk/dist/src/core/utils';
import { Convert } from 'symbol-sdk/dist/src/core/format';
import { Deadline, SignedTransaction, Transaction, TransferTransaction } from 'symbol-sdk/dist/src/model/transaction';

interface Network {
networkType: NetworkType;
Expand Down Expand Up @@ -84,8 +84,7 @@ export class SymbolService {
public async announce(signedTransaction: SignedTransaction) {
try {
const transactionRepo = this.repo.createTransactionRepository();
const result = await firstValueFrom(transactionRepo.announce(signedTransaction));
console.log(result);
await firstValueFrom(transactionRepo.announce(signedTransaction));
} catch (error: any) {
throw new Error('Cannot announce: ' + error.message);
}
Expand Down Expand Up @@ -129,7 +128,6 @@ export class SymbolService {

if (type === VoteType.SSS) {
try {
console.log(transferTransaction);
setTransaction(transferTransaction);
const signedTransaction = await requestSign();
await this.announce(signedTransaction);
Expand Down

0 comments on commit 57951e7

Please sign in to comment.