mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-19 02:53:17 +02:00
Display name sync
This commit is contained in:
parent
7ae8049438
commit
2fb4bd4975
12 changed files with 897 additions and 793 deletions
web/src/app
|
@ -175,6 +175,25 @@ class AccountApi {
|
|||
return subscription;
|
||||
}
|
||||
|
||||
async updateSubscription(remoteId, payload) {
|
||||
const url = accountSubscriptionSingleUrl(config.baseUrl, remoteId);
|
||||
const body = JSON.stringify(payload);
|
||||
console.log(`[AccountApi] Updating user subscription ${url}: ${body}`);
|
||||
const response = await fetch(url, {
|
||||
method: "PATCH",
|
||||
headers: maybeWithBearerAuth({}, session.token()),
|
||||
body: body
|
||||
});
|
||||
if (response.status === 401 || response.status === 403) {
|
||||
throw new UnauthorizedError();
|
||||
} else if (response.status !== 200) {
|
||||
throw new Error(`Unexpected server response ${response.status}`);
|
||||
}
|
||||
const subscription = await response.json();
|
||||
console.log(`[AccountApi] Subscription`, subscription);
|
||||
return subscription;
|
||||
}
|
||||
|
||||
async deleteSubscription(remoteId) {
|
||||
const url = accountSubscriptionSingleUrl(config.baseUrl, remoteId);
|
||||
console.log(`[AccountApi] Removing user subscription ${url}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue