Fix basePath references.

This commit is contained in:
Mike Cao 2021-01-14 00:34:51 -08:00
parent dfe157b640
commit 23d4d13c9d
5 changed files with 17 additions and 9 deletions

View file

@ -1,14 +1,16 @@
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useRouter } from 'next/router';
import { get } from 'lib/web';
import { setShareToken } from 'redux/actions/app';
export default function useShareToken(shareId) {
const { basePath } = useRouter();
const dispatch = useDispatch();
const shareToken = useSelector(state => state.app.shareToken);
async function loadToken(id) {
const { data } = await get(`/api/share/${id}`);
const { data } = await get(`${basePath}/api/share/${id}`);
if (data) {
dispatch(setShareToken(data));