Merge pull request #33 from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2022-12-27 01:18:41 +08:00 committed by GitHub
commit f51201a787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View file

@ -58,13 +58,19 @@ function Compose({
).info;
const configuration = useMemo(() => {
const instances = store.local.getJSON('instances');
const currentInstance = accounts.find(
(a) => a.info.id === currentAccount,
).instanceURL;
const config = instances[currentInstance].configuration;
console.log(config);
return config;
try {
const instances = store.local.getJSON('instances');
const currentInstance = accounts.find(
(a) => a.info.id === currentAccount,
).instanceURL;
const config = instances[currentInstance].configuration;
console.log(config);
return config;
} catch (e) {
alert('Failed to load instance configuration. Please try again.');
console.error(e);
return {};
}
}, []);
const {

View file

@ -953,7 +953,7 @@ function Poll({ poll, readOnly, onUpdate = () => {} }) {
setUIState('loading');
(async () => {
try {
const pollResponse = await masto.v1.poll.fetch(id);
const pollResponse = await masto.v1.polls.fetch(id);
onUpdate(pollResponse);
} catch (e) {
// Silent fail
@ -1038,7 +1038,7 @@ function Poll({ poll, readOnly, onUpdate = () => {} }) {
});
console.log(votes);
setUIState('loading');
const pollResponse = await masto.v1.poll.vote(id, {
const pollResponse = await masto.v1.polls.vote(id, {
choices: votes,
});
console.log(pollResponse);
@ -1087,7 +1087,7 @@ function Poll({ poll, readOnly, onUpdate = () => {} }) {
setUIState('loading');
(async () => {
try {
const pollResponse = await masto.v1.poll.fetch(id);
const pollResponse = await masto.v1.polls.fetch(id);
onUpdate(pollResponse);
} catch (e) {
// Silent fail