File tree 6 files changed +343
-286
lines changed
6 files changed +343
-286
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,6 @@ export default {
149
149
};
150
150
},
151
151
watch: {
152
- user : function (user ) {
153
- if (user) {
154
- this .$router .push ({
155
- name: " user" ,
156
- params: { username: this .user .username }
157
- });
158
- }
159
- },
160
152
$route : function () {
161
153
this .userDropdownActive = false ;
162
154
this .createDropdownActive = false ;
Original file line number Diff line number Diff line change 1
- import '@/css/tailwind.scss'
1
+ import "@/css/tailwind.scss" ;
2
+ import { getUser } from "@/util/auth" ;
2
3
import "@mdi/font/css/materialdesignicons.css" ;
3
-
4
4
import Vue from "vue" ;
5
5
import Vue2Filters from "vue2-filters" ;
6
6
import App from "./App.vue" ;
7
7
import router from "./router" ;
8
8
import store from "./store" ;
9
9
10
- import { getUser } from "@/util/auth" ;
11
-
12
10
Vue . use ( Vue2Filters ) ;
13
11
14
12
// TODO(sgotti) use vuex for login/logout
15
13
new Vue ( {
16
14
router,
17
15
store,
18
- created : function ( ) {
19
- let user = getUser ( )
16
+ created : function ( ) {
17
+ let user = getUser ( ) ;
20
18
if ( user ) {
21
- store . dispatch ( ' setUser' , user )
19
+ store . dispatch ( " setUser" , user ) ;
22
20
}
23
- store . dispatch ( "setRegisterUser" , null )
21
+ store . dispatch ( "setRegisterUser" , null ) ;
24
22
} ,
25
23
render : h => h ( App )
26
24
} ) . $mount ( "#app" ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import store from "@/store";
2
2
3
3
const ID_TOKEN_KEY = 'id_token' ;
4
4
const USER_KEY = 'user' ;
5
+ const LOGIN_REDIRECT_KEY = 'login_redirect' ;
5
6
6
7
let API_URL = window . CONFIG . API_URL ;
7
8
let API_BASE_PATH = window . CONFIG . API_BASE_PATH ;
@@ -125,3 +126,15 @@ export function isLoggedIn() {
125
126
const idToken = getIdToken ( ) ;
126
127
return ! ! idToken ;
127
128
}
129
+
130
+ export function getLoginRedirect ( ) {
131
+ return sessionStorage . getItem ( LOGIN_REDIRECT_KEY ) ;
132
+ }
133
+
134
+ export function setLoginRedirect ( url ) {
135
+ sessionStorage . setItem ( LOGIN_REDIRECT_KEY , url ) ;
136
+ }
137
+
138
+ export function unsetLoginRedirect ( ) {
139
+ return sessionStorage . removeItem ( LOGIN_REDIRECT_KEY ) ;
140
+ }
You can’t perform that action at this time.
0 commit comments