UNPKG

@magicbell/core

Version:
27 lines 803 B
import { fetchAPI, putAPI } from '../../lib/ajax.js'; /** * Class to interact with the user preferences API endpoints. * * @example * const repo = new NotificationPreferencesRepository(); * await repo.update({ categories: { comment: commentPreferences } }); */ export default class NotificationPreferencesRepository { remotePathOrUrl; constructor(remotePathOrUrl = '/notification_preferences') { this.remotePathOrUrl = remotePathOrUrl; } /** * Get the user preferences from the API server. */ get() { return fetchAPI(this.remotePathOrUrl); } /** * Update user preferences in the API server. */ update(data) { return putAPI(this.remotePathOrUrl, data); } } //# sourceMappingURL=NotificationPreferencesRepository.js.map