Fix UI bug with publish dialog
This commit is contained in:
parent
669d269fd9
commit
224c54b1a2
28 changed files with 75 additions and 69 deletions
|
@ -8,7 +8,7 @@ import {
|
|||
accountSubscriptionSingleUrl,
|
||||
accountSubscriptionUrl,
|
||||
accountTokenUrl,
|
||||
accountUrl,
|
||||
accountUrl, maybeWithBearerAuth,
|
||||
tiersUrl,
|
||||
withBasicAuth,
|
||||
withBearerAuth
|
||||
|
@ -78,7 +78,7 @@ class AccountApi {
|
|||
const url = accountUrl(config.base_url);
|
||||
console.log(`[AccountApi] Fetching user account ${url}`);
|
||||
const response = await fetchOrThrow(url, {
|
||||
headers: withBearerAuth({}, session.token())
|
||||
headers: maybeWithBearerAuth({}, session.token()) // GET /v1/account endpoint can be called by anonymous
|
||||
});
|
||||
const account = await response.json(); // May throw SyntaxError
|
||||
console.log(`[AccountApi] Account`, account);
|
||||
|
|
|
@ -113,6 +113,13 @@ export const maybeWithAuth = (headers, user) => {
|
|||
return headers;
|
||||
}
|
||||
|
||||
export const maybeWithBearerAuth = (headers, token) => {
|
||||
if (token) {
|
||||
return withBearerAuth(headers, token);
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
export const withBasicAuth = (headers, username, password) => {
|
||||
headers['Authorization'] = basicAuth(username, password);
|
||||
return headers;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import {Avatar} from "@mui/material";
|
||||
import Box from "@mui/material/Box";
|
||||
import logo from "../img/ntfy2.svg";
|
||||
import logo from "../img/ntfy-filled.svg";
|
||||
|
||||
const AvatarBox = (props) => {
|
||||
return (
|
||||
|
|
|
@ -412,8 +412,8 @@ const UserDialog = (props) => {
|
|||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={props.onCancel}>{t("prefs_users_dialog_button_cancel")}</Button>
|
||||
<Button onClick={handleSubmit} disabled={!addButtonEnabled}>{editMode ? t("prefs_users_dialog_button_save") : t("prefs_users_dialog_button_add")}</Button>
|
||||
<Button onClick={props.onCancel}>{t("common_cancel")}</Button>
|
||||
<Button onClick={handleSubmit} disabled={!addButtonEnabled}>{editMode ? t("common_save") : t("common_add")}</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
|
|
|
@ -76,8 +76,8 @@ export const ReserveAddDialog = (props) => {
|
|||
/>
|
||||
</DialogContent>
|
||||
<DialogFooter status={error}>
|
||||
<Button onClick={props.onClose}>{t("prefs_users_dialog_button_cancel")}</Button>
|
||||
<Button onClick={handleSubmit} disabled={!submitButtonEnabled}>{t("prefs_users_dialog_button_add")}</Button>
|
||||
<Button onClick={props.onClose}>{t("common_cancel")}</Button>
|
||||
<Button onClick={handleSubmit} disabled={!submitButtonEnabled}>{t("common_add")}</Button>
|
||||
</DialogFooter>
|
||||
</Dialog>
|
||||
);
|
||||
|
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue