Browse Source

fix(gui-v2): use promise reject when returning api error

pull/2932/head
braks 2 years ago
parent
commit
2684e21ec8
  1. 6
      packages/nc-gui-v2/composables/useApi/index.ts
  2. 2
      packages/nc-gui-v2/plugins/state.ts

6
packages/nc-gui-v2/composables/useApi/index.ts

@ -114,7 +114,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish()
return requestError
return Promise.reject(requestError)
},
)
@ -125,7 +125,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish()
return apiResponse
return Promise.resolve(apiResponse)
},
(apiError) => {
errorHook.trigger(apiError)
@ -133,7 +133,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish()
return apiError
return Promise.reject(apiError)
},
)

2
packages/nc-gui-v2/plugins/state.ts

@ -3,7 +3,7 @@ import { defineNuxtPlugin } from '#app'
import { useBreakpoints, useDark, useGlobal, watch } from '#imports'
/**
* Injects global state into nuxt app.
* Initialize global state and watches for changes
*
* @example
* ```js

Loading…
Cancel
Save