Skip to content

Commit

Permalink
fix: replacing fetchCurrentTeam with fetchCurrentTeamSettings in Gene…
Browse files Browse the repository at this point in the history
…ral Settings (#3663)
  • Loading branch information
RODO94 authored Sep 12, 2024
1 parent f037b2c commit be56687
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#8162d4f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#2dccab9",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
8 changes: 4 additions & 4 deletions api.planx.uk/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"packageManager": "[email protected]",
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#8162d4f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#2dccab9",
"axios": "^1.7.4",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/api-driven/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#8162d4f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#2dccab9",
"axios": "^1.7.4",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ui-driven/pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@mui/material": "^5.15.10",
"@mui/utils": "^5.15.11",
"@opensystemslab/map": "1.0.0-alpha.3",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#8162d4f",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#2dccab9",
"@tiptap/core": "^2.4.0",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.13",
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ const GeneralSettings: React.FC = () => {
useEffect(() => {
const fetchTeam = async () => {
try {
const fetchedTeam = await useStore.getState().fetchCurrentTeam();
if (!fetchedTeam) throw Error("Unable to find team");
const fetchedTeamSettings = await useStore
.getState()
.fetchCurrentTeamSettings();

if (!fetchedTeamSettings) throw Error("Unable to find team");

setFormikConfig({
initialValues: fetchedTeam.settings,
initialValues: fetchedTeamSettings,
onSubmit: () => {},
validateOnBlur: false,
validateOnChange: false,
Expand Down
6 changes: 6 additions & 0 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface TeamStore {
initTeamStore: (slug: string) => Promise<void>;
clearTeamStore: () => void;
fetchCurrentTeam: () => Promise<Team>;
fetchCurrentTeamSettings: () => Promise<TeamSettings>;
updateTeamTheme: (theme: Partial<TeamTheme>) => Promise<boolean>;
updateTeamSettings: (teamSettings: Partial<TeamSettings>) => Promise<boolean>;
createTeam: (newTeam: { name: string; slug: string }) => Promise<number>;
Expand Down Expand Up @@ -138,6 +139,11 @@ export const teamStore: StateCreator<
return await $client.team.getBySlug(teamSlug);
},

fetchCurrentTeamSettings: async () => {
const { teamSlug, $client } = get();
return await $client.team.getTeamSettings(teamSlug);
},

updateTeamTheme: async (theme: Partial<TeamTheme>) => {
const { teamId, $client } = get();
return await $client.team.updateTheme(teamId, theme);
Expand Down

0 comments on commit be56687

Please sign in to comment.