Skip to content

Commit

Permalink
remove unused code from utilActions (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
sickelap authored Jan 4, 2024
1 parent a4ff120 commit f059c0a
Showing 1 changed file with 1 addition and 98 deletions.
99 changes: 1 addition & 98 deletions src/actions/utilActions.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { api } from "../api_client/api";
import { Server } from "../api_client/apiClient";
import { notification } from "../service/notifications";
import { ManageUser, UserSchema } from "../store/user/user.zod";
import { UserSchema } from "../store/user/user.zod";
import { userActions } from "../store/user/userSlice";
import { scanPhotos } from "./photosActions";
import {
CountStats,
DeleteMissingPhotosResponse,
GenerateEventAlbumsResponse,
GenerateEventAlbumsTitlesResponse,
LocationSunburst,
LocationTimeline,
PhotoMonthCount,
SearchTermExamples,
WordCloudResponse,
} from "./utilActions.types";

Expand Down Expand Up @@ -48,25 +44,6 @@ export function updateUser(user, dispatch) {
});
}

export function updateUserAndScan(user) {
return function cb(dispatch) {
Server.patch(`manage/user/${user.id}/`, user)
.then(response => {
ManageUser.parse(response.data);
dispatch(userActions.updateRules(response.data));
dispatch(api.endpoints.fetchUserList.initiate()).refetch();
notification.updateUser(user.username);
dispatch(api.endpoints.fetchUserSelfDetails.initiate(user.id)).refetch();
if (user.scan_directory) {
dispatch(scanPhotos());
}
})
.catch(error => {
dispatch({ type: "UPDATE_USER_REJECTED", payload: error });
});
};
}

export function deleteMissingPhotos() {
return function cb(dispatch) {
dispatch({ type: "DELETE_MISSING_PHOTOS" });
Expand All @@ -91,30 +68,6 @@ export function deleteMissingPhotos() {
};
}

export function generateEventAlbums() {
return function cb(dispatch) {
dispatch({ type: "GENERATE_EVENT_ALBUMS" });
dispatch({ type: "SET_WORKER_AVAILABILITY", payload: false });
dispatch({
type: "SET_WORKER_RUNNING_JOB",
payload: { job_type_str: "Generate Event Albums" },
});
Server.get(`autoalbumgen/`)
.then(response => {
const data = GenerateEventAlbumsResponse.parse(response.data);
notification.generateEventAlbums();

dispatch({
type: "GENERATE_EVENT_ALBUMS_FULFILLED",
payload: data,
});
})
.catch(err => {
dispatch({ type: "GENERATE_EVENT_ALBUMS_REJECTED", payload: err });
});
};
}

export function generateEventAlbumTitles() {
return function cb(dispatch) {
dispatch({ type: "GENERATE_EVENT_ALBUMS_TITLES" });
Expand Down Expand Up @@ -143,23 +96,6 @@ export function generateEventAlbumTitles() {
};
}

export function fetchExampleSearchTerms() {
return function cb(dispatch) {
dispatch({ type: "FETCH_EXAMPLE_SEARCH_TERMS" });
Server.get(`searchtermexamples/`)
.then(response => {
const data = SearchTermExamples.parse(response.data.results);
dispatch({
type: "FETCH_EXAMPLE_SEARCH_TERMS_FULFILLED",
payload: data,
});
})
.catch(err => {
dispatch({ type: "FETCH_EXAMPLE_SEARCH_TERMS_REJECTED", payload: err });
});
};
}

export function fetchLocationSunburst() {
return function cb(dispatch) {
dispatch({ type: "FETCH_LOCATION_SUNBURST" });
Expand All @@ -177,21 +113,6 @@ export function fetchLocationSunburst() {
};
}

export function fetchLocationTimeline(dispatch) {
dispatch({ type: "FETCH_LOCATION_TIMELINE" });
Server.get(`locationtimeline/`)
.then(response => {
const data = LocationTimeline.parse(response.data);
dispatch({
type: "FETCH_LOCATION_TIMELINE_FULFILLED",
payload: data,
});
})
.catch(err => {
dispatch({ type: "FETCH_LOCATION_TIMELINE_REJECTED", payload: err });
});
}

export function fetchTimezoneList(dispatch) {
dispatch({ type: "FETCH_TIMEZONE_LIST" });
Server.get(`timezones/`)
Expand Down Expand Up @@ -223,24 +144,6 @@ export function fetchCountStats() {
};
}

export function fetchLocationClusters() {
return function cb(dispatch) {
dispatch({ type: "FETCH_LOCATION_CLUSTERS" });
Server.get(`locclust/`)
.then(response => {
// To-Do: Weird response from server
// const data = LocationCluster.array().parse(response.data);
dispatch({
type: "FETCH_LOCATION_CLUSTERS_FULFILLED",
payload: response.data,
});
})
.catch(err => {
dispatch({ type: "FETCH_LOCATION_CLUSTERS_REJECTED", payload: err });
});
};
}

export function fetchPhotoMonthCounts(dispatch) {
dispatch({ type: "FETCH_PHOTO_MONTH_COUNTS" });
Server.get(`photomonthcounts/`)
Expand Down

0 comments on commit f059c0a

Please sign in to comment.