blob: 873e67eb1f05a14b8825a403a7a3fefb7ec768f0 (
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
52
53
54
55
56
57
58
59
60
|
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<Site.Progress[]>("site/progress/add");
export const siteUpdateProgressCount = createAction<{
id: string;
count: number;
}>("site/progress/update_count");
export const siteRemoveProgress = createAsyncThunk(
"site/progress/remove",
async (ids: string[]) => {
await waitFor(3 * 1000);
return ids;
}
);
export const siteUpdateNotifier = createAction<string>(
"site/progress/update_notifier"
);
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;
}
);
|