mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Make sure that the legacy jsunit tests can still inject OC.config
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
2eadf9d567
commit
a143e36630
1 changed files with 14 additions and 6 deletions
|
|
@ -28,12 +28,18 @@ import { generateUrl } from './OC/routing'
|
|||
import OC from './OC'
|
||||
import { setToken as setRequestToken, getToken as getRequestToken } from './OC/requesttoken'
|
||||
|
||||
let config
|
||||
try {
|
||||
config = loadState('core', 'config')
|
||||
} catch (e) {
|
||||
// This fallback is just for our legacy jsunit tests since we have no way to mock loadState calls
|
||||
config = OC.config
|
||||
let config = null
|
||||
/**
|
||||
* The legacy jsunit tests overwrite OC.config before calling initCore
|
||||
* therefore we need to wait with assigning the config fallback until initCore calls initSessionHeartBeat
|
||||
*/
|
||||
const loadConfig = () => {
|
||||
try {
|
||||
config = loadState('core', 'config')
|
||||
} catch (e) {
|
||||
// This fallback is just for our legacy jsunit tests since we have no way to mock loadState calls
|
||||
config = OC.config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +137,8 @@ const registerAutoLogout = () => {
|
|||
* token doesn't expire
|
||||
*/
|
||||
export const initSessionHeartBeat = () => {
|
||||
loadConfig()
|
||||
|
||||
registerAutoLogout()
|
||||
|
||||
if (!keepSessionAlive()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue