Skip to content

Commit

Permalink
fix: global config can not be updated
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed May 11, 2023
1 parent d038a01 commit e00349c
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 59 deletions.
6 changes: 3 additions & 3 deletions src/GZCTF/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@types/react-pdf": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"@vitejs/plugin-react": "^3.1.0",
"axios": "^1.4.0",
"babel-plugin-prismjs": "^2.1.0",
"eslint": "8.37.0",
"form-data": "~4.0.0",
"lodash": "^4.17.21",
"prettier": "~2.8.8",
"rollup": "^3.21.5",
"rollup": "^3.21.6",
"swagger-typescript-api": "^12.0.4",
"tslib": "^2.5.0",
"typescript": "5.0.3",
Expand Down
104 changes: 52 additions & 52 deletions src/GZCTF/ClientApp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/GZCTF/ClientApp/src/pages/admin/Configs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import AdminPage from '@Components/admin/AdminPage'
import { SwitchLabel } from '@Components/admin/SwitchLabel'
import { showErrorNotification } from '@Utils/ApiErrorHandler'
import { useFixedButtonStyles } from '@Utils/ThemeOverride'
import { useConfig } from '@Utils/useConfig'
import api, { AccountPolicy, ConfigEditModel, GlobalConfig } from '@Api'

const Configs: FC = () => {
const { data: configs, mutate } = api.admin.useAdminGetConfigs({
refreshInterval: 0,
revalidateIfStale: false,
revalidateOnFocus: false,
})

const { mutate: mutateConfig } = useConfig()
const [disabled, setDisabled] = useState(false)
const [globalConfig, setGlobalConfig] = useState<GlobalConfig | null>()
const [accountPolicy, setAccountPolicy] = useState<AccountPolicy | null>()
Expand All @@ -40,7 +41,7 @@ const Configs: FC = () => {
})
.catch(showErrorNotification)
.finally(() => {
api.info.mutateInfoGetGlobalConfig()
mutateConfig({ ...conf.globalConfig })
setDisabled(false)
})
}
Expand Down
1 change: 0 additions & 1 deletion src/GZCTF/ClientApp/src/utils/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const useConfig = () => {
mutate,
} = api.info.useInfoGetGlobalConfig({
refreshInterval: 0,
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenHidden: false,
Expand Down
1 change: 0 additions & 1 deletion src/GZCTF/ClientApp/src/utils/useRecaptcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const loadReCaptcha = (siteKey: string) => {
export const useReCaptcha = (action: string) => {
const { data: sitekey, error } = api.info.useInfoGetRecaptchaSiteKey({
refreshInterval: 0,
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
refreshWhenHidden: false,
Expand Down

0 comments on commit e00349c

Please sign in to comment.