viewlogic 1.2.3 → 1.2.4
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/README.md +376 -445
- package/dist/viewlogic-router.js +26 -26
- package/dist/viewlogic-router.js.map +2 -2
- package/dist/viewlogic-router.min.js +3 -3
- package/dist/viewlogic-router.min.js.map +3 -3
- package/package.json +1 -1
package/dist/viewlogic-router.js
CHANGED
|
@@ -387,7 +387,12 @@ var AuthManager = class {
|
|
|
387
387
|
}
|
|
388
388
|
if (typeof this.config.checkAuthFunction === "function") {
|
|
389
389
|
try {
|
|
390
|
-
const
|
|
390
|
+
const route = {
|
|
391
|
+
name: routeName,
|
|
392
|
+
$api: this.router.routeLoader.apiHandler.bindToComponent({}),
|
|
393
|
+
$state: this.router.stateHandler
|
|
394
|
+
};
|
|
395
|
+
const isAuthenticated2 = await this.config.checkAuthFunction(route);
|
|
391
396
|
return {
|
|
392
397
|
allowed: isAuthenticated2,
|
|
393
398
|
reason: isAuthenticated2 ? "custom_auth_success" : "custom_auth_failed",
|
|
@@ -1247,9 +1252,9 @@ var FormHandler = class {
|
|
|
1247
1252
|
const form = event.target;
|
|
1248
1253
|
let action = form.getAttribute("action");
|
|
1249
1254
|
const method = form.getAttribute("method") || "POST";
|
|
1250
|
-
const successHandler = form.getAttribute("data-success
|
|
1251
|
-
const errorHandler = form.getAttribute("data-error
|
|
1252
|
-
const loadingHandler = form.getAttribute("data-loading
|
|
1255
|
+
const successHandler = form.getAttribute("data-success");
|
|
1256
|
+
const errorHandler = form.getAttribute("data-error");
|
|
1257
|
+
const loadingHandler = form.getAttribute("data-loading");
|
|
1253
1258
|
const redirectTo = form.getAttribute("data-redirect");
|
|
1254
1259
|
action = this.processActionParams(action, component);
|
|
1255
1260
|
if (!this.validateForm(form, component)) {
|
|
@@ -2036,6 +2041,7 @@ ${template}`;
|
|
|
2036
2041
|
...originalData,
|
|
2037
2042
|
currentRoute: routeName,
|
|
2038
2043
|
$query: router.queryManager?.getQueryParams() || {},
|
|
2044
|
+
$params: router.queryManager?.getRouteParams() || {},
|
|
2039
2045
|
$lang: (() => {
|
|
2040
2046
|
try {
|
|
2041
2047
|
return router.i18nManager?.getCurrentLanguage() || router.config.i18nDefaultLanguage || router.config.defaultLanguage || "ko";
|
|
@@ -2057,11 +2063,12 @@ ${template}`;
|
|
|
2057
2063
|
},
|
|
2058
2064
|
async mounted() {
|
|
2059
2065
|
this.$api = router.routeLoader.apiHandler.bindToComponent(this);
|
|
2066
|
+
this.$state = router.stateHandler;
|
|
2060
2067
|
if (script.mounted) {
|
|
2061
2068
|
await script.mounted.call(this);
|
|
2062
2069
|
}
|
|
2063
2070
|
if (script.dataURL) {
|
|
2064
|
-
await this
|
|
2071
|
+
await this.fetchData();
|
|
2065
2072
|
}
|
|
2066
2073
|
await this.$nextTick();
|
|
2067
2074
|
router.routeLoader.formHandler.bindAutoForms(this);
|
|
@@ -2083,29 +2090,22 @@ ${template}`;
|
|
|
2083
2090
|
return key;
|
|
2084
2091
|
}
|
|
2085
2092
|
},
|
|
2086
|
-
// 인증 관련
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
set: (key, value) => router.stateHandler?.set(key, value),
|
|
2100
|
-
has: (key) => router.stateHandler?.has(key) || false,
|
|
2101
|
-
delete: (key) => router.stateHandler?.delete(key) || false,
|
|
2102
|
-
update: (updates) => router.stateHandler?.update(updates),
|
|
2103
|
-
watch: (key, callback) => router.stateHandler?.watch(key, callback),
|
|
2104
|
-
unwatch: (key, callback) => router.stateHandler?.unwatch(key, callback),
|
|
2105
|
-
getAll: () => router.stateHandler?.getAll() || {}
|
|
2093
|
+
// 인증 관련 (핵심 4개 메소드만)
|
|
2094
|
+
isAuth: () => router.authManager?.isAuthenticated() || false,
|
|
2095
|
+
logout: () => router.authManager ? router.navigateTo(router.authManager.logout()) : null,
|
|
2096
|
+
getToken: () => router.authManager?.getAccessToken() || null,
|
|
2097
|
+
setToken: (token, options) => router.authManager?.setAccessToken(token, options) || false,
|
|
2098
|
+
// i18n 언어 관리
|
|
2099
|
+
getLanguage: () => router.i18nManager?.getCurrentLanguage() || router.config.defaultLanguage || "ko",
|
|
2100
|
+
setLanguage: (lang) => router.i18nManager?.setLanguage(lang),
|
|
2101
|
+
// 로깅 및 에러 처리
|
|
2102
|
+
log: (level, ...args) => {
|
|
2103
|
+
if (router.errorHandler) {
|
|
2104
|
+
router.errorHandler.log(level, `[${routeName}]`, ...args);
|
|
2105
|
+
}
|
|
2106
2106
|
},
|
|
2107
2107
|
// 데이터 fetch (ApiHandler 래퍼)
|
|
2108
|
-
async
|
|
2108
|
+
async fetchData(dataConfig = null) {
|
|
2109
2109
|
const configToUse = dataConfig || script.dataURL;
|
|
2110
2110
|
if (!configToUse) return null;
|
|
2111
2111
|
this.$dataLoading = true;
|