MCPcopy
hub / github.com/linuxfoundation/crowd.dev / doInit

Function doInit

frontend/src/modules/auth/store/actions.js:18–40  ·  view source on GitHub ↗
({ commit, dispatch })

Source from the content-addressed store, hash-verified

16
17export default {
18 async doInit({ commit, dispatch }) {
19 try {
20 const token = AuthToken.get();
21 if (token) {
22 const currentUser = await AuthService.fetchMe();
23 connectSocket(token);
24 commit('AUTH_INIT_SUCCESS', { currentUser });
25 return currentUser;
26 }
27
28 disconnectSocket();
29 commit('AUTH_INIT_ERROR');
30 return null;
31 } catch (error) {
32 console.error(error);
33 disconnectSocket();
34 commit('AUTH_INIT_ERROR');
35 dispatch('doSignout');
36 return null;
37 } finally {
38 ProgressBar.done();
39 }
40 },
41
42 doWaitUntilInit({ getters }) {
43 if (!getters.loadingInit) {

Callers

nothing calls this directly

Calls 6

connectSocketFunction · 0.90
disconnectSocketFunction · 0.90
fetchMeMethod · 0.80
doneMethod · 0.80
getMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected