fix(ui): update UI to handle uploads with alternate URLs (#3274)

This commit is contained in:
Mary Hipp Rogers 2023-04-26 07:14:08 -07:00 committed by GitHub
commit a3c5a664e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import { IRect } from 'konva/lib/types';
import { clamp } from 'lodash'; import { clamp } from 'lodash';
import { isImageOutput } from 'services/types/guards'; import { isImageOutput } from 'services/types/guards';
import { imageUploaded } from 'services/thunks/image'; import { imageUploaded } from 'services/thunks/image';
import { deserializeImageResponse } from 'services/util/deserializeImageResponse';
export type GalleryCategory = 'user' | 'result'; export type GalleryCategory = 'user' | 'result';
@ -295,9 +296,10 @@ export const gallerySlice = createSlice({
* Upload Image - FULFILLED * Upload Image - FULFILLED
*/ */
builder.addCase(imageUploaded.fulfilled, (state, action) => { builder.addCase(imageUploaded.fulfilled, (state, action) => {
const { location } = action.payload; const { response } = action.payload;
const imageName = location.split('/').pop() || '';
state.selectedImageName = imageName; const uploadedImage = deserializeImageResponse(response);
state.selectedImageName = uploadedImage.name;
}); });
}, },
}); });