@fy-/fws-vue 0.3.69 → 0.3.71
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/composables/rest.ts +4 -2
- package/package.json +1 -1
package/composables/rest.ts
CHANGED
|
@@ -40,12 +40,13 @@ export function useRest(): <ResultType extends APIResult>(
|
|
|
40
40
|
params?: RestParams,
|
|
41
41
|
): Promise<ResultType> => {
|
|
42
42
|
const requestHash = stringHash(url + method + JSON.stringify(params));
|
|
43
|
-
if (
|
|
43
|
+
if (getMode() !== "ssr") {
|
|
44
44
|
const hasResult = restStore.getResult(requestHash);
|
|
45
45
|
if (hasResult !== undefined) {
|
|
46
46
|
const result = hasResult as ResultType;
|
|
47
47
|
restStore.removeResult(requestHash);
|
|
48
48
|
if (result.result === "error") {
|
|
49
|
+
eventBus.emit("main-loading", false);
|
|
49
50
|
eventBus.emit("rest-error", result);
|
|
50
51
|
return Promise.reject(result);
|
|
51
52
|
}
|
|
@@ -62,6 +63,7 @@ export function useRest(): <ResultType extends APIResult>(
|
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
if (restResult.result === "error") {
|
|
66
|
+
eventBus.emit("main-loading", false);
|
|
65
67
|
eventBus.emit("rest-error", restResult);
|
|
66
68
|
return Promise.reject(restResult);
|
|
67
69
|
}
|
|
@@ -71,7 +73,7 @@ export function useRest(): <ResultType extends APIResult>(
|
|
|
71
73
|
if (getMode() === "ssr") {
|
|
72
74
|
restStore.addResult(requestHash, restError);
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
eventBus.emit("main-loading", false);
|
|
75
77
|
eventBus.emit("rest-error", restError);
|
|
76
78
|
return Promise.resolve(restError);
|
|
77
79
|
}
|