File size: 871 Bytes
13555f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) 2021-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import browser from 'webextension-polyfill'

interface Settings {
  host: string | null
  username: string | null
  token: string | null
  boardId: string | null
}
 
export function loadSettings(): Settings {
  return browser.storage.sync.get(['host', 'username', 'token', 'boardId'])
}

export function storeSettings(host: string, username: string, token: string | null, boardId: string | null) {
  console.log(`storing host ${host}`)
  return browser.storage.sync.set({ host: host, username: username, token: token, boardId: boardId })
}

export function storeToken(value: string | null) {
  return browser.storage.sync.set({ token: value })
}

export function storeBoardId(value: string | null) {
  return browser.storage.sync.set({ boardId: value })
}