blob: 89f89c0c77a282e0219ec9389f26b15ddcf4b691 (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import { createAction, createAsyncThunk } from "@reduxjs/toolkit";
import { BadgesApi } from "../../apis";
import { waitFor } from "../../utilites";
import { systemUpdateAllSettings } from "./system";
export const siteBootstrap = createAsyncThunk(
"site/bootstrap",
(_: undefined, { dispatch }) => {
return Promise.all([
dispatch(systemUpdateAllSettings()),
dispatch(siteUpdateBadges()),
]);
}
);
export const siteUpdateInitialization = createAction<string | true>(
"site/initialization/update"
);
export const siteRedirectToAuth = createAction("site/redirect_auth");
export const siteAddNotifications = createAction<Server.Notification[]>(
"site/notifications/add"
);
export const siteRemoveNotifications = createAction<string>(
"site/notifications/remove"
);
export const siteAddProgress =
createAction<Server.Progress[]>("site/progress/add");
export const siteRemoveProgress = createAsyncThunk(
"site/progress/remove",
async (ids: string[]) => {
await waitFor(3 * 1000);
return ids;
}
);
export const siteChangeSidebar = createAction<string>("site/sidebar/update");
export const siteUpdateOffline = createAction<boolean>("site/offline/update");
export const siteUpdateBadges = createAsyncThunk(
"site/badges/update",
async () => {
const response = await BadgesApi.all();
return response;
}
);
|