fix: remove vendorCode from vendor API paths
Vendor API endpoints use JWT authentication, not URL path parameters. The vendorCode should only be used for page URLs (navigation), not API calls. Fixed API paths in 10 vendor JS files: - analytics.js, customers.js, inventory.js, notifications.js - order-detail.js, orders.js, products.js, profile.js - settings.js, team.js Added architecture rule JS-014 to prevent this pattern from recurring. Added validation check _check_vendor_api_paths to validate_architecture.py. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
12
static/vendor/js/notifications.js
vendored
12
static/vendor/js/notifications.js
vendored
@@ -95,7 +95,7 @@ function vendorNotifications() {
|
||||
params.append('unread_only', 'true');
|
||||
}
|
||||
|
||||
const response = await apiClient.get(`/vendor/${this.vendorCode}/notifications?${params}`);
|
||||
const response = await apiClient.get(`/vendor/notifications?${params}`);
|
||||
|
||||
this.notifications = response.notifications || [];
|
||||
this.stats.total = response.total || 0;
|
||||
@@ -115,7 +115,7 @@ function vendorNotifications() {
|
||||
*/
|
||||
async markAsRead(notification) {
|
||||
try {
|
||||
await apiClient.put(`/vendor/${this.vendorCode}/notifications/${notification.id}/read`);
|
||||
await apiClient.put(`/vendor/notifications/${notification.id}/read`);
|
||||
|
||||
// Update local state
|
||||
notification.is_read = true;
|
||||
@@ -133,7 +133,7 @@ function vendorNotifications() {
|
||||
*/
|
||||
async markAllAsRead() {
|
||||
try {
|
||||
await apiClient.put(`/vendor/${this.vendorCode}/notifications/mark-all-read`);
|
||||
await apiClient.put(`/vendor/notifications/mark-all-read`);
|
||||
|
||||
// Update local state
|
||||
this.notifications.forEach(n => n.is_read = true);
|
||||
@@ -155,7 +155,7 @@ function vendorNotifications() {
|
||||
}
|
||||
|
||||
try {
|
||||
await apiClient.delete(`/vendor/${this.vendorCode}/notifications/${notificationId}`);
|
||||
await apiClient.delete(`/vendor/notifications/${notificationId}`);
|
||||
|
||||
// Remove from local state
|
||||
const wasUnread = this.notifications.find(n => n.id === notificationId && !n.is_read);
|
||||
@@ -177,7 +177,7 @@ function vendorNotifications() {
|
||||
*/
|
||||
async openSettingsModal() {
|
||||
try {
|
||||
const response = await apiClient.get(`/vendor/${this.vendorCode}/notifications/settings`);
|
||||
const response = await apiClient.get(`/vendor/notifications/settings`);
|
||||
this.settingsForm = {
|
||||
email_notifications: response.email_notifications !== false,
|
||||
in_app_notifications: response.in_app_notifications !== false
|
||||
@@ -194,7 +194,7 @@ function vendorNotifications() {
|
||||
*/
|
||||
async saveSettings() {
|
||||
try {
|
||||
await apiClient.put(`/vendor/${this.vendorCode}/notifications/settings`, this.settingsForm);
|
||||
await apiClient.put(`/vendor/notifications/settings`, this.settingsForm);
|
||||
Utils.showToast('Notification settings saved', 'success');
|
||||
this.showSettingsModal = false;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user