mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 00:32:35 +10:00
fix(printer): fix issue with printer service, locating the right URL of the server
This commit is contained in:
@ -36,13 +36,14 @@ RUN apk add --no-cache curl \
|
||||
|
||||
COPY --from=builder /app/pnpm-*.yaml ./
|
||||
COPY --from=builder /app/package.json ./
|
||||
COPY --from=builder /app/client/package.json ./client/package.json
|
||||
|
||||
RUN pnpm install -F client --frozen-lockfile --prod
|
||||
|
||||
COPY --from=builder /app/client/.next ./client/.next
|
||||
COPY --from=builder /app/client/public ./client/public
|
||||
COPY --from=builder /app/client/next.config.js ./client/next.config.js
|
||||
COPY --from=builder /app/client/next-i18next.config.js ./client/next-i18next.config.js
|
||||
COPY --from=builder /app/client/package.json ./client/package.json
|
||||
|
||||
RUN pnpm install -F client --frozen-lockfile --prod
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ const ArtboardController: React.FC<ReactZoomPanPinchRef> = ({ zoomIn, zoomOut, c
|
||||
|
||||
const url = await mutateAsync({ username, slug });
|
||||
|
||||
download(url);
|
||||
download(`/api${url}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@ -47,7 +47,7 @@ const Export = () => {
|
||||
|
||||
const url = await mutateAsync({ username, slug });
|
||||
|
||||
download(url);
|
||||
download(`/api${url}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@ -90,7 +90,7 @@ const Preview: NextPage<Props> = ({ username, slug, resume: initialData }) => {
|
||||
try {
|
||||
const url = await mutateAsync({ username, slug });
|
||||
|
||||
download(url);
|
||||
download(`/api${url}`);
|
||||
} catch {
|
||||
toast.error('Something went wrong, please try again later.');
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ const Home: NextPage = () => {
|
||||
</section>
|
||||
|
||||
<section className={styles.section}>
|
||||
<a href="https://www.digitalocean.com/" target="_blank" rel="noreferrer">
|
||||
<a href="https://pillai.xyz/digitalocean" target="_blank" rel="noreferrer">
|
||||
<Image src="/images/sponsors/digitalocean.svg" alt="Powered By DigitalOcean" width={200} height={40} />
|
||||
</a>
|
||||
</section>
|
||||
|
||||
@ -60,7 +60,7 @@ const Preview: NextPage<Props> = ({ shortId }) => {
|
||||
try {
|
||||
const url = await mutateAsync({ username: resume.user.username, slug: resume.slug });
|
||||
|
||||
download(url);
|
||||
download(`/api${url}`);
|
||||
} catch {
|
||||
toast.error('Something went wrong, please try again later.');
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import env from '@beam-australia/react-env';
|
||||
import { Resume } from '@reactive-resume/schema';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import _axios, { AxiosResponse } from 'axios';
|
||||
|
||||
import isBrowser from '@/utils/isBrowser';
|
||||
|
||||
@ -22,9 +22,6 @@ export type FetchResumeByIdentifierParams = {
|
||||
|
||||
export type FetchResumeByShortIdParams = {
|
||||
shortId: string;
|
||||
options?: {
|
||||
secretKey?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type RenameResumeParams = {
|
||||
@ -60,23 +57,26 @@ export type DeleteResumeParams = {
|
||||
|
||||
export const fetchResumes = () => axios.get<Resume[]>('/resume').then((res) => res.data);
|
||||
|
||||
export const fetchResumeByShortId = async ({ shortId, options = { secretKey: '' } }: FetchResumeByShortIdParams) => {
|
||||
const requestOptions = isEmpty(options.secretKey) ? {} : { params: { secretKey: options.secretKey } };
|
||||
|
||||
return axios.get<Resume>(`/resume/short/${shortId}`, requestOptions).then((res) => res.data);
|
||||
};
|
||||
|
||||
export const fetchResumeByIdentifier = async ({
|
||||
username,
|
||||
slug,
|
||||
options = { secretKey: '' },
|
||||
}: FetchResumeByIdentifierParams) => {
|
||||
const prefix = !isBrowser && process.env.NODE_ENV === 'development' ? 'http://localhost:3100' : '';
|
||||
const requestOptions = isEmpty(options.secretKey) ? {} : { params: { secretKey: options.secretKey } };
|
||||
if (!isBrowser) {
|
||||
const serverUrl = env('SERVER_URL');
|
||||
const secretKey = options.secretKey;
|
||||
|
||||
return axios.get<Resume>(`${prefix}/resume/${username}/${slug}`, requestOptions).then((res) => res.data);
|
||||
return _axios
|
||||
.get<Resume>(`${serverUrl}/resume/${username}/${slug}`, { params: { secretKey } })
|
||||
.then((res) => res.data);
|
||||
}
|
||||
|
||||
return axios.get<Resume>(`/resume/${username}/${slug}`).then((res) => res.data);
|
||||
};
|
||||
|
||||
export const fetchResumeByShortId = async ({ shortId }: FetchResumeByShortIdParams) =>
|
||||
axios.get<Resume>(`/resume/short/${shortId}`).then((res) => res.data);
|
||||
|
||||
export const createResume = (createResumeParams: CreateResumeParams) =>
|
||||
axios.post<Resume, AxiosResponse<Resume>, CreateResumeParams>('/resume', createResumeParams).then((res) => res.data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user