mirror of
https://github.com/mue/mue.git
synced 2026-07-26 10:11:15 +02:00
feat: upgrade to API v2
This commit is contained in:
@@ -75,7 +75,7 @@ export default class Create extends PureComponent {
|
||||
key === 'showReminder' ||
|
||||
key === 'experimental' ||
|
||||
key === 'debugtimeout' ||
|
||||
key === 'quotelanguage'
|
||||
key === 'quoteLanguage'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class LanguageSettings extends PureComponent {
|
||||
this.controller = new AbortController();
|
||||
}
|
||||
|
||||
async getQuoteLanguages() {
|
||||
async getquoteLanguages() {
|
||||
const data = await (
|
||||
await fetch(variables.constants.API_URL + '/quotes/languages', {
|
||||
signal: this.controller.signal,
|
||||
@@ -55,7 +55,7 @@ export default class LanguageSettings extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
this.getQuoteLanguages();
|
||||
this.getquoteLanguages();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -76,7 +76,7 @@ export default class LanguageSettings extends PureComponent {
|
||||
{variables.getMessage('modals.main.settings.sections.language.quote')}
|
||||
</span>
|
||||
<div className="languageSettings">
|
||||
<Radio name="quotelanguage" options={this.state.quoteLanguages} category="quote" />
|
||||
<Radio name="quoteLanguage" options={this.state.quoteLanguages} category="quote" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -105,7 +105,7 @@ export default class OrderSettings extends PureComponent {
|
||||
};
|
||||
|
||||
async getNews() {
|
||||
const data = await (await fetch('https://api.muetab.com/news')).json();
|
||||
const data = await (await fetch(variables.constants.API_URL + '/news')).json();
|
||||
data.news.date = new window.Date(data.news.date).toLocaleDateString(variables.languagecode.replace('_', '-'), {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class TimeSettings extends PureComponent {
|
||||
async (position) => {
|
||||
const data = await (
|
||||
await fetch(
|
||||
`${variables.constants.PROXY_URL}/weather/autolocation?lat=${position.coords.latitude}&lon=${position.coords.longitude}`,
|
||||
`${variables.constants.API_URL}/gps?latitude=${position.coords.latitude}&longitude=${position.coords.longitude}`,
|
||||
)
|
||||
).json();
|
||||
this.setState({
|
||||
|
||||
@@ -114,7 +114,7 @@ export default class BackgroundSettings extends PureComponent {
|
||||
<>
|
||||
<Dropdown
|
||||
label={variables.getMessage('modals.main.settings.sections.background.category')}
|
||||
name="apiCategory"
|
||||
name="apiCategories"
|
||||
>
|
||||
<MenuItem value="loading" key="loading">
|
||||
{variables.getMessage('modals.main.loading')}
|
||||
@@ -127,11 +127,11 @@ export default class BackgroundSettings extends PureComponent {
|
||||
) : (
|
||||
<Dropdown
|
||||
label={variables.getMessage('modals.main.settings.sections.background.category')}
|
||||
name="apiCategory"
|
||||
name="apiCategories"
|
||||
>
|
||||
{this.state.backgroundCategories.map((category) => (
|
||||
<MenuItem value={category} key={category}>
|
||||
{category.charAt(0).toUpperCase() + category.slice(1)}
|
||||
<MenuItem value={category.name} key={category.name}>
|
||||
{category.name.charAt(0).toUpperCase() + category.name.slice(1)} ({category.count})
|
||||
</MenuItem>
|
||||
))}
|
||||
</Dropdown>
|
||||
|
||||
Reference in New Issue
Block a user