@fishawack/lab-velocity 1.6.0 → 1.8.0
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.
|
@@ -4,13 +4,14 @@ function setAxiosDefaults() {
|
|
|
4
4
|
axios.defaults.baseURL = process.env.APP_URL;
|
|
5
5
|
axios.defaults.withCredentials = true;
|
|
6
6
|
axios.defaults.withXSRFToken = true;
|
|
7
|
+
|
|
8
|
+
// Some libraries will utilize the globally available version of axios so make sure it's our exact axios instance
|
|
9
|
+
window.axios = axios;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
// Some libraries will utilize the globally available version of axios so make sure it's our exact axios instance
|
|
10
12
|
// Redirect to login page if 401
|
|
11
13
|
axios.interceptors.response.use(null, (error) => {
|
|
12
14
|
if (error.response) {
|
|
13
|
-
|
|
14
15
|
if (error.response.status === 401) {
|
|
15
16
|
store.commit("setAuth", false);
|
|
16
17
|
router.push({ name: `${store.state.auth.authBase}.login` });
|
|
@@ -24,4 +25,35 @@ axios.interceptors.response.use(null, (error) => {
|
|
|
24
25
|
return Promise.reject(error);
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
// Pull all paginated data
|
|
29
|
+
axios.getAll = (url, options = {}) => {
|
|
30
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
31
|
+
return new Promise(async (resolve, reject) => {
|
|
32
|
+
try {
|
|
33
|
+
const arr = { data: { data: [] } };
|
|
34
|
+
let page = 0;
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line no-constant-condition
|
|
37
|
+
while (true) {
|
|
38
|
+
// eslint-disable-next-line no-await-in-loop
|
|
39
|
+
const res = await axios.get(
|
|
40
|
+
// eslint-disable-next-line no-plusplus
|
|
41
|
+
`${url}${url.includes("?") ? "&" : "?"}page=${++page}`,
|
|
42
|
+
options
|
|
43
|
+
);
|
|
44
|
+
arr.data.data = arr.data.data.concat(res.data.data);
|
|
45
|
+
if (
|
|
46
|
+
res.data.next_page_url === null ||
|
|
47
|
+
(res.data.links && res.data.links.next === null)
|
|
48
|
+
)
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resolve(arr);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
setAxiosDefaults();
|
|
@@ -97,6 +97,14 @@ export function authRoutes(node, store, nested = 'auth') {
|
|
|
97
97
|
component: require("../routes/account-exists.vue").default,
|
|
98
98
|
name: `${nested}.account-exists`,
|
|
99
99
|
},
|
|
100
|
+
{
|
|
101
|
+
path: "logout",
|
|
102
|
+
component: require("../routes/logout.vue").default,
|
|
103
|
+
name: `${nested}.logout`,
|
|
104
|
+
meta: {
|
|
105
|
+
guest: true,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
100
108
|
],
|
|
101
109
|
props: true,
|
|
102
110
|
nav: {
|
|
@@ -175,4 +183,4 @@ export function configureRoutes(router) {
|
|
|
175
183
|
}
|
|
176
184
|
});
|
|
177
185
|
|
|
178
|
-
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
metaInfo() {
|
|
4
|
+
return {
|
|
5
|
+
title: "Logout",
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
mounted() {
|
|
10
|
+
try {
|
|
11
|
+
this.$store.dispatch("logout", {
|
|
12
|
+
errors: this.$root.errors,
|
|
13
|
+
});
|
|
14
|
+
} catch(e){
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.$router.push({ name: `${this.$store.state.auth.authBase}.login` });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
</script>
|
package/components/_basic.scss
CHANGED
package/components/_button.scss
CHANGED
|
@@ -115,3 +115,22 @@
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
.lab-table, .lab-table-cell, .lab-table-header {
|
|
121
|
+
border: solid .5px $color1;
|
|
122
|
+
}
|
|
123
|
+
.lab-table-header {
|
|
124
|
+
background-color: $color5;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.lab-table {
|
|
128
|
+
a {
|
|
129
|
+
text-decoration: underline;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
.lab-table-cell {
|
|
133
|
+
&:active, &:focus-within, &.selectedCell {
|
|
134
|
+
background-color: transparentize($color: $color5, $amount: .8);
|
|
135
|
+
}
|
|
136
|
+
}
|