MCPcopy Create free account
hub / github.com/Authenticator-Extension/Authenticator / getModule

Method getModule

src/store/Advisor.ts:62–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61export class Advisor implements Module {
62 async getModule() {
63 await UserSettings.updateItems();
64 return {
65 state: {
66 insights: await this.getInsights(),
67 ignoreList: UserSettings.items.advisorIgnoreList || [],
68 },
69 mutations: {
70 dismissInsight: async (state: AdvisorState, insightId: string) => {
71 state.ignoreList.push(insightId);
72 UserSettings.items.advisorIgnoreList = state.ignoreList;
73 UserSettings.commitItems();
74
75 state.insights = await this.getInsights();
76 },
77 clearIgnoreList: async (state: AdvisorState) => {
78 state.ignoreList = [];
79 UserSettings.items.advisorIgnoreList = undefined;
80 UserSettings.commitItems();
81
82 state.insights = await this.getInsights();
83 },
84 updateInsight: async (state: AdvisorState) => {
85 state.insights = await this.getInsights();
86 state.ignoreList =
87 typeof UserSettings.items.advisorIgnoreList === "string"
88 ? JSON.parse(UserSettings.items.advisorIgnoreList || "[]")
89 : UserSettings.items.advisorIgnoreList || [];
90 },
91 },
92 namespaced: true,
93 };
94 }
95
96 private async getInsights() {
97 await UserSettings.updateItems();

Callers

nothing calls this directly

Calls 3

getInsightsMethod · 0.95
updateItemsMethod · 0.80
commitItemsMethod · 0.80

Tested by

no test coverage detected