Skip to content

Commit

Permalink
refactor(web): simpify queries keys
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jul 10, 2024
1 parent 7e3babe commit 4733b12
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/src/queries/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { timezoneUTCOffset } from "~/utils";
*/
const configQuery = () => {
return {
queryKey: ["l10n", "config"],
queryKey: ["l10n/config"],
queryFn: () => fetch("/api/l10n/config").then((res) => res.json()),
};
};
Expand All @@ -38,7 +38,7 @@ const configQuery = () => {
* Returns a query for retrieving the list of known locales
*/
const localesQuery = () => ({
queryKey: ["l10n", "locales"],
queryKey: ["l10n/locales"],
queryFn: async () => {
const response = await fetch("/api/l10n/locales");
const locales = await response.json();
Expand All @@ -53,7 +53,7 @@ const localesQuery = () => ({
* Returns a query for retrieving the list of known timezones
*/
const timezonesQuery = () => ({
queryKey: ["l10n", "timezones"],
queryKey: ["l10n/timezones"],
queryFn: async () => {
const response = await fetch("/api/l10n/timezones");
const timezones = await response.json();
Expand All @@ -69,7 +69,7 @@ const timezonesQuery = () => ({
* Returns a query for retrieving the list of known keymaps
*/
const keymapsQuery = () => ({
queryKey: ["l10n", "keymaps"],
queryKey: ["l10n/keymaps"],
queryFn: async () => {
const response = await fetch("/api/l10n/keymaps");
const json = await response.json();
Expand Down Expand Up @@ -115,7 +115,7 @@ const useL10nConfigChanges = () => {

return client.ws().onEvent(event => {
if (event.type === "L10nConfigChanged") {
queryClient.invalidateQueries({ queryKey });
queryClient.invalidateQueries({ queryKey: ["l10n/config"] });
}
});
}, [client, queryClient]);
Expand Down

0 comments on commit 4733b12

Please sign in to comment.