shared-ritm 1.0.28 → 1.0.30
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/dist/shared-ritm.es.js +902 -901
- package/dist/shared-ritm.umd.js +3 -3
- package/dist/types/api/services/AuthService.d.ts +12 -0
- package/dist/types/api/settings/ApiService.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/services/AuthService.ts +37 -0
- package/src/api/settings/ApiService.ts +1 -1
- package/src/common/app-sidebar/AppSidebar.vue +3 -2
- package/src/index.ts +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService';
|
|
2
|
+
type LoginResponse = {
|
|
3
|
+
token: string;
|
|
4
|
+
user: any;
|
|
5
|
+
};
|
|
6
|
+
declare class AuthService extends ApiService {
|
|
7
|
+
login(email: string, password: string): Promise<LoginResponse>;
|
|
8
|
+
logout(): Promise<LoginResponse>;
|
|
9
|
+
configs(): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export default function useAuthService(): AuthService;
|
|
12
|
+
export {};
|
|
@@ -15,7 +15,7 @@ export default class ApiService {
|
|
|
15
15
|
constructor();
|
|
16
16
|
private getToken;
|
|
17
17
|
private removeToken;
|
|
18
|
-
|
|
18
|
+
logout(): void;
|
|
19
19
|
private handleError;
|
|
20
20
|
protected get<T>(url: string, options?: AxiosRequestConfig): Promise<T>;
|
|
21
21
|
protected delete<T>(url: string, options?: AxiosRequestConfig): Promise<AxiosResponse<T, any>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ import useRepairsService from '@/api/services/RepairsService';
|
|
|
15
15
|
import useTasksService from '@/api/services/TasksService';
|
|
16
16
|
export { AppButton, AppInput, AppToggle, AppInputSearch, AppLayout, AppSelect, AppWrapper, AppSidebar, AppLayoutHeader, AppLoader, };
|
|
17
17
|
export { useGanttService, useMetricsService, useProjectsService, useRepairsService, useTasksService };
|
|
18
|
-
export * from '@/api/types/Api_Repairs';
|
|
19
18
|
export * from '@/api/types/Api_Tasks';
|
|
19
|
+
export * from '@/api/types/Api_Repairs';
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ApiService from '@/api/settings/ApiService'
|
|
2
|
+
|
|
3
|
+
type LoginPayload = {
|
|
4
|
+
email: string
|
|
5
|
+
password: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type LoginResponse = {
|
|
9
|
+
token: string
|
|
10
|
+
user: any
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type ConfigResponse = any
|
|
14
|
+
|
|
15
|
+
class AuthService extends ApiService {
|
|
16
|
+
public login(email: string, password: string) {
|
|
17
|
+
return this.post<LoginPayload, LoginResponse>(`/login`, {
|
|
18
|
+
email,
|
|
19
|
+
password,
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public logout() {
|
|
24
|
+
return this.post<null, LoginResponse>(`/logout`, null)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public configs() {
|
|
28
|
+
return this.get<ConfigResponse>(`/configs`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let api: AuthService
|
|
33
|
+
|
|
34
|
+
export default function useAuthService() {
|
|
35
|
+
if (!api) api = new AuthService()
|
|
36
|
+
return api
|
|
37
|
+
}
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
58
|
<script setup lang="ts">
|
|
59
|
-
import { computed, defineProps, ref, watch } from 'vue'
|
|
59
|
+
import { computed, defineProps, defineEmits, ref, watch } from 'vue'
|
|
60
60
|
import SidebarMenu from './components/SidebarMenu.vue'
|
|
61
61
|
|
|
62
62
|
import { useQuasar } from 'quasar'
|
|
@@ -67,6 +67,7 @@ interface Props {
|
|
|
67
67
|
minify?: boolean
|
|
68
68
|
menuItems?: any[]
|
|
69
69
|
}
|
|
70
|
+
const emits = defineEmits(['logout'])
|
|
70
71
|
const props = defineProps<Props>()
|
|
71
72
|
const $q = useQuasar()
|
|
72
73
|
|
|
@@ -89,7 +90,7 @@ function openDrawerIsTablet() {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
function logout(): void {
|
|
92
|
-
|
|
93
|
+
emits('logout')
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
watch(
|
package/src/index.ts
CHANGED