@iservice365/layer-common 0.0.1 → 0.0.2
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 +6 -0
- package/composables/useLocal.ts +0 -7
- package/composables/useLocalAuth.ts +2 -8
- package/composables/useUtils.ts +7 -0
- package/error.vue +41 -0
- package/layouts/plain.vue +7 -0
- package/nuxt.config.ts +4 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/composables/useLocal.ts
CHANGED
|
@@ -22,12 +22,6 @@ export default function useLocal() {
|
|
|
22
22
|
];
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
function redirect(link: string, page?: string) {
|
|
26
|
-
const href = page ? `${link}/${page}` : link;
|
|
27
|
-
|
|
28
|
-
window.location.href = href;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
25
|
const headerSearch = useState("headerSearch", () => "");
|
|
32
26
|
|
|
33
27
|
return {
|
|
@@ -35,7 +29,6 @@ export default function useLocal() {
|
|
|
35
29
|
getUserFromCookie,
|
|
36
30
|
drawer,
|
|
37
31
|
apps,
|
|
38
|
-
redirect,
|
|
39
32
|
headerSearch,
|
|
40
33
|
};
|
|
41
34
|
}
|
|
@@ -2,22 +2,16 @@ export default function useLocalAuth() {
|
|
|
2
2
|
const { cookieConfig } = useRuntimeConfig().public;
|
|
3
3
|
|
|
4
4
|
async function login({ email = "", password = "" }) {
|
|
5
|
-
return useNuxtApp().$api<
|
|
5
|
+
return useNuxtApp().$api<Record<string, any>>("/api/auth", {
|
|
6
6
|
method: "POST",
|
|
7
7
|
body: JSON.stringify({ email, password }),
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function setToken({
|
|
12
|
-
refreshToken = "",
|
|
13
|
-
accessToken = "",
|
|
14
|
-
user = "",
|
|
15
|
-
org = "",
|
|
16
|
-
}) {
|
|
11
|
+
function setToken({ refreshToken = "", accessToken = "", user = "" }) {
|
|
17
12
|
useCookie("accessToken", cookieConfig).value = accessToken;
|
|
18
13
|
useCookie("refreshToken", cookieConfig).value = refreshToken;
|
|
19
14
|
useCookie("user", cookieConfig).value = user;
|
|
20
|
-
useCookie("org", cookieConfig).value = org;
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
function clearCookies() {
|
package/composables/useUtils.ts
CHANGED
|
@@ -93,6 +93,12 @@ export default function useUtils() {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
function redirect(link: string, page?: string) {
|
|
97
|
+
const href = page ? `${link}/${page}` : link;
|
|
98
|
+
|
|
99
|
+
window.location.href = href;
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
return {
|
|
97
103
|
requiredRule,
|
|
98
104
|
emailRule,
|
|
@@ -105,5 +111,6 @@ export default function useUtils() {
|
|
|
105
111
|
insertBetween,
|
|
106
112
|
getNameInitials,
|
|
107
113
|
getDimensions,
|
|
114
|
+
redirect,
|
|
108
115
|
};
|
|
109
116
|
}
|
package/error.vue
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NuxtError } from "#app";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
error: Object as () => NuxtError,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<v-app>
|
|
11
|
+
<v-main>
|
|
12
|
+
<v-row
|
|
13
|
+
class="fill-height"
|
|
14
|
+
no-gutters
|
|
15
|
+
justify="center"
|
|
16
|
+
align-content="center"
|
|
17
|
+
>
|
|
18
|
+
<v-col cols="9">
|
|
19
|
+
<v-row>
|
|
20
|
+
<v-col cols="12" class="text-center text-h2">
|
|
21
|
+
<span class="font-weight-bold">{{ props.error?.message }}</span>
|
|
22
|
+
</v-col>
|
|
23
|
+
<v-col cols="12">
|
|
24
|
+
<v-row no-gutters justify="center">
|
|
25
|
+
<v-btn
|
|
26
|
+
rounded="xl"
|
|
27
|
+
size="large"
|
|
28
|
+
class="text-none font-weight-bold"
|
|
29
|
+
variant="tonal"
|
|
30
|
+
:to="{ name: 'index' }"
|
|
31
|
+
>
|
|
32
|
+
Go back
|
|
33
|
+
</v-btn>
|
|
34
|
+
</v-row>
|
|
35
|
+
</v-col>
|
|
36
|
+
</v-row>
|
|
37
|
+
</v-col>
|
|
38
|
+
</v-row>
|
|
39
|
+
</v-main>
|
|
40
|
+
</v-app>
|
|
41
|
+
</template>
|
package/nuxt.config.ts
CHANGED
|
@@ -13,31 +13,14 @@ export default defineNuxtConfig({
|
|
|
13
13
|
secure: true,
|
|
14
14
|
maxAge: 30 * 24 * 60 * 60,
|
|
15
15
|
},
|
|
16
|
+
API_DO_STORAGE_ENDPOINT:
|
|
17
|
+
(process.env.API_DO_STORAGE_ENDPOINT as string) ?? "",
|
|
16
18
|
APP_NAME: (process.env.APP_NAME as string) ?? "App",
|
|
17
19
|
APP_NAME_ROUTE: (process.env.APP_NAME_ROUTE as string) ?? "index",
|
|
20
|
+
APP_MAIN: (process.env.APP_MAIN as string) ?? "",
|
|
18
21
|
APP_ACCOUNT: (process.env.APP_ACCOUNT as string) ?? "",
|
|
19
|
-
APP_PROJECT: (process.env.APP_PROJECT as string) ?? "",
|
|
20
|
-
APP_DEPED_HQ: (process.env.APP_DEPED_HQ as string) ?? "",
|
|
21
|
-
APP_REGION_HQ: (process.env.APP_REGION_HQ as string) ?? "",
|
|
22
|
-
APP_DIVISION_HQ: (process.env.APP_DIVISION_HQ as string) ?? "",
|
|
23
|
-
APP_SCHOOL_HQ: (process.env.APP_SCHOOL_HQ as string) ?? "",
|
|
24
|
-
APP_STUDENT_ZONE: (process.env.APP_STUDENT_ZONE as string) ?? "",
|
|
25
|
-
APP_PARENT_PORTAL: (process.env.APP_PARENT_PORTAL as string) ?? "",
|
|
26
|
-
APP_BOOK_KEEPING: (process.env.APP_BOOK_KEEPING as string) ?? "",
|
|
27
|
-
APP_ASSET_MANAGEMENT: (process.env.APP_ASSET as string) ?? "",
|
|
28
|
-
APP_EMPLOYEE_MANAGEMENT:
|
|
29
|
-
(process.env.APP_EMPLOYEE_MANAGEMENT as string) ?? "",
|
|
30
|
-
APP_PAYROLL: (process.env.APP_PAYROLL as string) ?? "",
|
|
31
|
-
APP_ATTENDANCE_KEEPING:
|
|
32
|
-
(process.env.APP_ATTENDANCE_KEEPING as string) ?? "",
|
|
33
|
-
APP_LEAVE_MANAGEMENT: (process.env.APP_LEAVE_MANAGEMENT as string) ?? "",
|
|
34
|
-
APP_PROPERTY_MANAGEMENT:
|
|
35
|
-
(process.env.APP_PROPERTY_MANAGEMENT as string) ?? "",
|
|
36
|
-
APP_RECRUITMENT: (process.env.APP_RECRUITMENT as string) ?? "",
|
|
37
|
-
API_DO_STORAGE_ENDPOINT:
|
|
38
|
-
(process.env.API_DO_STORAGE_ENDPOINT as string) ?? "",
|
|
39
22
|
APP_ADMIN: (process.env.APP_ADMIN as string) ?? "",
|
|
40
|
-
|
|
23
|
+
APP_ORG: (process.env.APP_ORG as string) ?? "",
|
|
41
24
|
},
|
|
42
25
|
},
|
|
43
26
|
|