@stevederico/skateboard-ui 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ 2.15.0
4
+
5
+ Add authOverlay 401 retry logic
6
+ Add SHOW_AUTH_OVERLAY dispatch
7
+
3
8
  2.14.0
4
9
 
5
10
  Switch icons to Lucide React
package/core/Utilities.js CHANGED
@@ -723,11 +723,31 @@ export async function apiRequest(endpoint, options = {}) {
723
723
  if (timeoutId) clearTimeout(timeoutId);
724
724
  }
725
725
 
726
- // Handle 401 (redirect to signout, unless authOverlay mode)
726
+ // Handle 401 (redirect to signout, or show auth overlay and retry)
727
727
  if (response.status === 401) {
728
728
  if (getConstants().authOverlay !== true) {
729
729
  window.location.href = '/signout';
730
+ throw new Error('Unauthorized');
730
731
  }
732
+
733
+ // In authOverlay mode: show sign-in overlay, retry request after auth
734
+ const dispatch = getDispatch();
735
+ if (dispatch) {
736
+ return new Promise((resolve, reject) => {
737
+ dispatch({
738
+ type: 'SHOW_AUTH_OVERLAY',
739
+ payload: async () => {
740
+ try {
741
+ const result = await apiRequest(endpoint, options);
742
+ resolve(result);
743
+ } catch (err) {
744
+ reject(err);
745
+ }
746
+ }
747
+ });
748
+ });
749
+ }
750
+
731
751
  throw new Error('Unauthorized');
732
752
  }
733
753
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "2.14.0",
4
+ "version": "2.15.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./Sidebar": {