@fy-/fws-vue 0.3.58 → 0.3.60
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/components/fws/UserOAuth2.vue +15 -2
- package/composables/rest.ts +4 -0
- package/package.json +1 -1
|
@@ -13,6 +13,17 @@ const isAuth = computed(() => userStore.isAuth);
|
|
|
13
13
|
const data = ref();
|
|
14
14
|
const providersData = ref();
|
|
15
15
|
const usedProviders = ref<Record<string, boolean>>({});
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
returnTo: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false,
|
|
20
|
+
default: "/user/account?tab=user_settings",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const returnTo = ref(props.returnTo);
|
|
24
|
+
if (returnTo.value == "") {
|
|
25
|
+
returnTo.value = "/user/account?tab=user_settings";
|
|
26
|
+
}
|
|
16
27
|
const getOAuth2Providers = async () => {
|
|
17
28
|
eventBus.emit("main-loading", true);
|
|
18
29
|
const d = await rest("User/OAuth2/Providers", "GET");
|
|
@@ -23,7 +34,9 @@ const getOAuth2Providers = async () => {
|
|
|
23
34
|
};
|
|
24
35
|
const getOAuth2Redirect = async (providerUUID: string) => {
|
|
25
36
|
eventBus.emit("main-loading", true);
|
|
26
|
-
const d = await rest(`User/OAuth2/Provider/${providerUUID}`, "
|
|
37
|
+
const d = await rest(`User/OAuth2/Provider/${providerUUID}`, "POST", {
|
|
38
|
+
ReturnTo: returnTo.value,
|
|
39
|
+
});
|
|
27
40
|
if (d && d.result == "success") {
|
|
28
41
|
window.location.href = d.data;
|
|
29
42
|
}
|
|
@@ -103,7 +116,7 @@ onMounted(() => {
|
|
|
103
116
|
</div>
|
|
104
117
|
</template>
|
|
105
118
|
</DefaultModal>
|
|
106
|
-
<h2 class="
|
|
119
|
+
<h2 class="h3 flex items-center justify-between">
|
|
107
120
|
<span>{{ $t("oauth2_providers_title") }}</span>
|
|
108
121
|
<button
|
|
109
122
|
class="btn primary medium !py-1 !px-3"
|
package/composables/rest.ts
CHANGED
|
@@ -61,6 +61,10 @@ export function useRest(): <ResultType extends APIResult>(
|
|
|
61
61
|
JSON.parse(JSON.stringify(restResult)),
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
+
if (restResult.result === "error") {
|
|
65
|
+
eventBus.emit("rest-error", restResult);
|
|
66
|
+
return Promise.reject(restResult);
|
|
67
|
+
}
|
|
64
68
|
return Promise.resolve(restResult);
|
|
65
69
|
} catch (error) {
|
|
66
70
|
const restError: ResultType = error as ResultType;
|